Android layout Android Studio中的设计和输出完全不同

Android layout Android Studio中的设计和输出完全不同,android-layout,android-studio,Android Layout,Android Studio,当我运行演示项目时,它只显示name TextView。 我该怎么办?有解决办法吗? 期望值: 现实: 尝试更改布局(从android.support.constraint.ConstraintLayout开始) 到(相对的) 并更改编辑文本 和按钮 和文本视图 依靠相对论 试试这段代码,如果行得通的话,我会修改你案例的属性 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http:/

当我运行演示项目时,它只显示name TextView。 我该怎么办?有解决办法吗? 期望值:

现实:

尝试更改布局(从android.support.constraint.ConstraintLayout开始)

到(相对的)

并更改编辑文本 和按钮 和文本视图 依靠相对论

试试这段代码,如果行得通的话,我会修改你案例的属性

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="@drawable/"
android:padding="80dp">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:orientation="vertical">

    <EditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Name" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Name" />

    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <TextView
        android:id="@+id/textView8"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="TextView" />
</LinearLayout>
</RelativeLayout>


请详细解释并发布您的代码。感谢您的帮助。刚刚开始android开发。任何时候都不要忘记在此处替换背景图像,它将显示错误android:background=“@drawable/”