Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用约束布局。蓝图中的每件事似乎都很完美,但当我运行应用程序时,视图并不到位_Android_Xml_Layout_Constraints - Fatal编程技术网

Android 使用约束布局。蓝图中的每件事似乎都很完美,但当我运行应用程序时,视图并不到位

Android 使用约束布局。蓝图中的每件事似乎都很完美,但当我运行应用程序时,视图并不到位,android,xml,layout,constraints,Android,Xml,Layout,Constraints,我正在为我的项目建立一个单一的屏幕,但面临一些问题 我正在使用下面提供的代码 我所面临的问题是,在buleprint/design选项卡中,每件事情似乎都很好,但每件事情都乱七八糟的视图并没有保留在应该保留的位置上 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.c

我正在为我的项目建立一个单一的屏幕,但面临一些问题 我正在使用下面提供的代码 我所面临的问题是,在buleprint/design选项卡中,每件事情似乎都很好,但每件事情都乱七八糟的视图并没有保留在应该保留的位置上

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.abhisharma.themobileshop.MainActivity">

<ImageView
    android:id="@+id/imageView"
    android:layout_width="393dp"
    android:layout_height="241dp"

    android:scaleType="center"
    android:cropToPadding="false"
    app:srcCompat="@drawable/a"
    android:layout_marginBottom="-9dp"
    app:layout_constraintBottom_toTopOf="@+id/imageView3"
    android:layout_marginLeft="3dp"
    app:layout_constraintLeft_toLeftOf="@+id/imageView3" />

<EditText
    android:id="@+id/editText2"
    android:layout_width="129dp"
    android:layout_height="38dp"
    android:ems="10"
    android:inputType="textPersonName"
    android:text="Top Brands"
    android:textColor="@android:color/holo_red_dark"
    app:layout_constraintLeft_toRightOf="@+id/imageView5"
    android:layout_marginLeft="26dp"
    android:layout_marginBottom="48dp"
    app:layout_constraintBottom_toTopOf="@+id/imageView4" />

<EditText
    android:id="@+id/editText3"
    android:layout_width="98dp"
    android:layout_height="38dp"
    android:ems="10"
    android:inputType="textPersonName"
    android:text="Top Deals!!"
    android:textColor="@android:color/holo_red_dark"
    app:layout_constraintBottom_toBottomOf="@+id/imageView6"
    android:layout_marginBottom="0dp"
    android:layout_marginLeft="8dp"
    app:layout_constraintLeft_toLeftOf="parent" />

<TextView
    android:id="@+id/textView"
    android:layout_width="377dp"
    android:layout_height="29dp"
    android:text="Open seven days a week 9 am to 7 pm (except public holidays"
    android:layout_marginLeft="8dp"
    app:layout_constraintLeft_toLeftOf="parent"
    android:layout_marginBottom="8dp"
    app:layout_constraintBottom_toTopOf="@+id/textView3"
    android:layout_marginRight="8dp"
    app:layout_constraintRight_toRightOf="parent" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Contact : +919999049952"
    tools:layout_editor_absoluteY="478dp"
    android:layout_marginLeft="8dp"
    app:layout_constraintLeft_toLeftOf="parent"
    android:layout_marginRight="8dp"
    app:layout_constraintRight_toRightOf="parent" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="shop number 6, the main market faridabad ,121007"
    android:layout_marginBottom="6dp"
    app:layout_constraintBottom_toTopOf="@+id/textView2"
    android:layout_marginLeft="8dp"
    app:layout_constraintLeft_toLeftOf="parent"
    android:layout_marginRight="8dp"
    app:layout_constraintRight_toRightOf="parent" />

<TextView
    android:id="@+id/textView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="We deal all kind of mobile phone,aaccessories and repair"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintHorizontal_bias="0.565"
    android:layout_marginBottom="31dp"
    app:layout_constraintBottom_toTopOf="@+id/textView"
    android:layout_marginTop="8dp"
    app:layout_constraintTop_toBottomOf="@+id/imageView6"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp" />

<TextView
    android:id="@+id/textView5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="BEST PRICE IN THE MARKET"
    android:layout_marginRight="86dp"
    app:layout_constraintRight_toRightOf="@+id/imageView4"
    android:layout_marginTop="8dp"
    app:layout_constraintTop_toBottomOf="@+id/imageView5"
    app:layout_constraintLeft_toRightOf="@+id/editText3"
    android:layout_marginLeft="0dp" />

<ImageView
    android:id="@+id/imageView3"
    android:layout_width="54dp"
    android:layout_height="45dp"
    app:srcCompat="@drawable/apple"
    app:layout_constraintRight_toLeftOf="@+id/imageView5"
    android:layout_marginRight="64dp"
    android:layout_marginBottom="23dp"
    app:layout_constraintBottom_toTopOf="@+id/editText3"
    android:layout_marginLeft="8dp"
    app:layout_constraintLeft_toLeftOf="parent" />

<ImageView
    android:id="@+id/imageView4"
    android:layout_width="109dp"
    android:layout_height="29dp"
    app:srcCompat="@drawable/gio"
    tools:layout_editor_absoluteX="259dp"
    android:layout_marginBottom="8dp"
    app:layout_constraintBottom_toTopOf="@+id/textView4"
    android:layout_marginTop="8dp"
    app:layout_constraintTop_toBottomOf="@+id/textView5" />

<ImageView
    android:id="@+id/imageView5"
    android:layout_width="95dp"
    android:layout_height="46dp"
    app:srcCompat="@drawable/sam"
    tools:layout_editor_absoluteX="136dp"
    tools:layout_editor_absoluteY="207dp" />

<ImageView
    android:id="@+id/imageView6"
    android:layout_width="113dp"
    android:layout_height="30dp"
    app:srcCompat="@drawable/leno"
    tools:layout_editor_absoluteY="289dp"
    tools:layout_editor_absoluteX="136dp" />

已经回答了

如前所述

注意:由于API的变化,在升级到alpha 8之后,您可能必须重新启动Android Studio 2.2才能进行布局预览


因此,从菜单栏中选择文件,然后选择“使缓存失效/重新启动”

它没有帮助:/i我在运行应用程序时遇到问题,在设计模式下它看起来很好