Android `Reformat code` option rearranges the order of my views in the layout

30 Views Asked by At

I've just updated to Android Studio 3.5 and Code -> Reformat code previously just rearranged the attributes in each of my Views defined in the layouts. But now, it reorganizez the entire views order entirely, which is no good.

I need, for instance, to have a View at the bottom of the layout, so that it gets drawn at the end, on top of everything else and act as a click overlay on other views. Reformat code now moves the View at the start of the parent container, and interacting with it and its main purpose is useless now.

I can't find the option in the Settings of the IDE from where to switch this unnecessary thing off. Any help?

It converts this:

<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>

To this:

    <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>
0

There are 0 best solutions below