Android Studio模拟器中的项目位置错误

A. *_*rkh 2 java xml android android-emulator android-layout

我是android studio的新手,这是我的第一个应用程序.它工作正常,但有模拟器的问题,它显示错误的位置按钮.

<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.dell_pc.myapplication.MainActivity">

    <EditText
        android:id="@+id/txtyear"
        android:layout_width="193dp"
        android:layout_height="60dp"
        android:ems="10"
        android:hint="Enter year of birth"
        android:inputType="number"
        tools:layout_editor_absoluteY="129dp"
        tools:layout_editor_absoluteX="96dp" />

    <Button
        android:id="@+id/butage"
        android:layout_width="115dp"
        android:layout_height="41dp"
        android:onClick="BuGetAge"
        android:text="Show Age"
        tools:layout_editor_absoluteY="277dp"
        tools:layout_editor_absoluteX="135dp" />

</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

如何让它出现在正确的位置?

模拟器的图片

小智 6

在activity_main.xml中选择Component/Item(例如BUTTON) - >点击"Infer Constrains(我在附件中显示)"

您的项目将在ASE中正确放置

对其余组件/项目执行相同操作

请享用