1

我刚刚更新到 Android Studio 3.5,Code -> Reformat code之前只是重新排列了我Views在布局中定义的每个属性。但是现在,它把整个views秩序彻底重组了,这不好。

例如,我需要在布局的底部有一个视图,以便在最后绘制,在其他所有内容之上并充当其他视图的点击叠加层。Reformat code现在移动View父容器的开头,并与它交互,它的主要目的现在没用了。

我在 IDE 的设置中找不到从哪里关闭这个不必要的东西的选项。有什么帮助吗?

它转换这个:

<RelativeLayout
    android:id="@+id/address_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/header">

    <com.widgets.MTextInput
        android:id="@+id/address_input_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="10dp"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp">

        <com.widgets.MEditText
            android:id="@+id/address_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:focusable="false"
            android:inputType="text"
            android:textSize="14sp"
            custom:key="Address" />

    </com.MTextInput>

    <View
        android:id="@+id/address_mask"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/address_input_text"
        android:layout_alignEnd="@+id/address_input_text"
        android:layout_alignStart="@+id/address_input_text"
        android:layout_alignTop="@+id/address_input_text" />

</RelativeLayout>

对此:

    <View
        android:id="@+id/address_mask"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/address_input_text"
        android:layout_alignEnd="@+id/address_input_text"
        android:layout_alignStart="@+id/address_input_text"
        android:layout_alignTop="@+id/address_input_text" />

    <com.widgets.MTextInput
        android:id="@+id/address_input_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="10dp"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp">

        <com.widgets.MEditText
            android:id="@+id/address_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:focusable="false"
            android:inputType="text"
            android:textSize="14sp"
            custom:key="Address" />

    </com.widgets.MTextInput>

</RelativeLayout>
4

0 回答 0