Android Studio XML closing tag indentation

Viewed 2431

I have a TextView defined as

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/nav_header_vertical_spacing"
        android:text="Semita"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        />

But I don't like the closing tag on the same indentation level as the attributes. When I hit backspace I'd like it to look like:

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/nav_header_vertical_spacing"
        android:text="Semita"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
    />

which is what I'd like, I instead get:

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="@dimen/nav_header_vertical_spacing"
    android:text="Semita"
    android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>

where the /> is on the same level as the attributes. How can I change this behavior?

5 Answers

Go to Settings -> Editor -> Code Style -> XML and select Android tab In Layout Files section check "Insert line break after last attribute"enter image description here

Related