Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.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 ConstraintLayout在使用仿真器运行后是无序的_Android_Android Constraintlayout - Fatal编程技术网

Android ConstraintLayout在使用仿真器运行后是无序的

Android ConstraintLayout在使用仿真器运行后是无序的,android,android-constraintlayout,Android,Android Constraintlayout,创建约束布局后,我使用AVD(Android虚拟设备)运行它。结果,这些对象被粘在左上角,所有对象都混在一起。(请看图片) 这是我的XML文件: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schem

创建约束布局后,我使用AVD(Android虚拟设备)运行它。结果,这些对象被粘在左上角,所有对象都混在一起。(请看图片)

这是我的XML文件:

<?xml version="1.0" encoding="utf-8"?>
<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.pc.myapplication.MainActivity">

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="username"
    tools:layout_editor_absoluteX="232dp"
    tools:layout_editor_absoluteY="143dp" />

<EditText
    android:id="@+id/TFusername"
    android:layout_width="368dp"
    android:layout_height="40dp"
    android:ems="10"
    android:inputType="textPersonName"
    tools:layout_editor_absoluteX="376dp"
    tools:layout_editor_absoluteY="133dp" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="password"
    tools:layout_editor_absoluteX="232dp"
    tools:layout_editor_absoluteY="228dp" />

<EditText
    android:id="@+id/TFpassword"
    android:layout_width="368dp"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="textPassword"
    tools:layout_editor_absoluteX="376dp"
    tools:layout_editor_absoluteY="213dp" />

   <Button
    android:id="@+id/BLogin"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="onButtonClick"
    android:text="Login"
    tools:layout_editor_absoluteX="503dp"
    tools:layout_editor_absoluteY="307dp" />
 </android.support.constraint.ConstraintLayout>

我看到了一些关于同一问题的问题,解决方案是更新约束布局版本。但是,在我的例子中,安装的constraint layout版本是1.0.2(新版本)。
此问题是否有解决方案?

您需要向视图添加约束,以确定它们在屏幕上的显示方式

我想你需要多读一些关于


如果您在理解过程中遇到任何问题,请告诉我

我看不到您对视图添加了任何约束,它们应该具有一些属性,如
app:constraint\u top\u toBottomOf
。阅读一些教程again@jalel你能做到这一点吗?可能是