每当我更改Android线性布局的属性时,它都会对子级进行重新排序

每当我更改Android线性布局的属性时,它都会对子级进行重新排序,android,xml,android-layout,android-linearlayout,android-scrollview,Android,Xml,Android Layout,Android Linearlayout,Android Scrollview,我是一个android初学者,所以如果这是一个愚蠢的问题,请原谅我 我正在尝试创建一个包含表单的基本活动—一系列问题文本视图,每个视图后面都有一个答案字段EditText,底部有一个提交按钮。表单比屏幕长一点,所以我将它们都包含在滚动视图中,然后是线性布局中 但每次我更新线性布局或滚动视图的属性(例如修改容器大小或设置重心)时,线性布局中的项目都会重新排序,使提交按钮位于顶部,然后是所有编辑文本,然后是所有文本视图。XML也被重新排序 它并没有阻止我的应用程序运行,因为我可以对它们重新排序,然后

我是一个android初学者,所以如果这是一个愚蠢的问题,请原谅我

我正在尝试创建一个包含表单的基本活动—一系列问题文本视图,每个视图后面都有一个答案字段EditText,底部有一个提交按钮。表单比屏幕长一点,所以我将它们都包含在滚动视图中,然后是线性布局中

但每次我更新线性布局或滚动视图的属性(例如修改容器大小或设置重心)时,线性布局中的项目都会重新排序,使提交按钮位于顶部,然后是所有编辑文本,然后是所有文本视图。XML也被重新排序

它并没有阻止我的应用程序运行,因为我可以对它们重新排序,然后按go键,只要我不需要调整任何东西,但这真的很难处理,因为我花了很长时间重新排序它们-我想知道我做错了什么

感谢您的帮助

xml在下面没有附带java,活动仍然为空:

<?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=".CreateNewEventActivity">

    <ScrollView
        android:layout_width="409dp"
        android:layout_height="601dp"
        android:layout_marginBottom="1dp"
        android:layout_marginEnd="1dp"
        android:layout_marginStart="1dp"
        android:layout_marginTop="1dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_horizontal"
            android:orientation="vertical">

            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="CREATE" />

            <EditText
                android:id="@+id/dateEditText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:inputType="date"
                android:textSize="28sp" />

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

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

            <EditText
                android:id="@+id/participantEditText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:inputType="number"
                android:textSize="28sp" />

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

            <TextView
                android:id="@+id/introTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center|center_horizontal|center_vertical"
                android:text="INTRO \n"
                android:textAlignment="center"
                android:textSize="40sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/dateTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="TextView"
                android:textSize="28sp" />

            <TextView
                android:id="@+id/locationTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="TextView"
                android:textSize="28sp" />

            <TextView
                android:id="@+id/themeTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="TextView"
                android:textSize="28sp" />

            <TextView
                android:id="@+id/participantTextView1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="TextView"
                android:textSize="28sp" />

            <TextView
                android:id="@+id/participantTextView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="TextView"
                android:textSize="28sp" />

            <TextView
                android:id="@+id/choseEventIdTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="TextView"
                android:textSize="28sp" />

        </LinearLayout>
    </ScrollView>
</android.support.constraint.ConstraintLayout>

这是android studio 3.5 Canary 8中的一个已知问题,已在android studio中修复。有关更多详细信息,请查看问题129457736。所以你需要做的就是更新你的Android Studio版本

编辑XML代码时,IDE可能会应用错误的代码样式 从菜单栏中选择“代码>重新格式化代码”时。要解决这个问题 问题,按如下方式重置相应的Android代码样式

如果要保留Android Studio版本,请执行以下操作:

通过单击macOS上的文件>设置、Android Studio>首选项打开设置窗口。 在左侧面板中,单击编辑器>代码样式>XML。 在右面板右上角附近,选择“从>预定义样式>Android设置” 单击“确定”您可能需要重新启动Android Studio
在您重新格式化代码Ctrl+alt+L后,它是否对视图重新排序?是的,它确实。。。我甚至不知道这是一个功能嗯,我的Android工作室告诉我它是4.0版,于2020年5月20日发布?我应该把它恢复到3.5.2吗?它是最新版本吗?您应该更新到最新版本。如果不起作用,请尝试按照上述步骤进行修复