1

I updated my Android Studio to version 3.5 and currently when I press option-command-L (Reformat code) it change order of views and tags. For example:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        ...
    </data>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <androidx.appcompat.widget.AppCompatButton
            style="@style/TransferButtonStyle"
            android:drawableTop="@{storeInfo.icon}"
            android:text="@{storeInfo.name}"
            tools:drawableTop="@drawable/ic_axidrop" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/grey_80_opacity"
            android:layout_gravity="center_horizontal"
            android:textSize="12sp"
            android:text="@{storeInfo.category}"
            tools:text="Jewellery" />
    </LinearLayout>
</layout>

after Reformat code :

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="@{storeInfo.category}"
            android:textColor="@color/grey_80_opacity"
            android:textSize="12sp"
            tools:text="Jewellery" />

        <androidx.appcompat.widget.AppCompatButton
            style="@style/TransferButtonStyle"
            android:drawableTop="@{storeInfo.icon}"
            android:text="@{storeInfo.name}"
            tools:drawableTop="@drawable/ic_axidrop" />
    </LinearLayout>

    <data>
        ...
    </data>
</layout>

which is break my view. It is looks like the bug in Studio or in Editor rules. Is someone know how to fix it?

Peter Staranchuk
  • 1,343
  • 3
  • 14
  • 29

0 Answers0