Search code examples
androidxmlandroid-studio-3.3

Weird XML formation after Android studio was updated to 3.3. How to get android style formation of xml back?


I've updated my Android Studio to 3.3 version and after it when I drag some new view from pallet it makes its XML very weird, with wrong spaces and two-three attributes android:blabla in the same line. When I make hotkey command + shift + L it turn all code in that style with wrong spaces. How to fix it?

  <Button
      android:id="@+id/buttonLiteVersion"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:onClick="onLiteVersion"
      android:text="@string/lite_version_name"
      style="@style/MainMenuButton"
      android:layout_weight="1"/>
  <Button
          android:text="Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" android:id="@+id/button2" android:layout_weight="1"/>

The upper is before update, the lower is after update

My settings for editor


Solution

  • If command + shift + L (on pc its Ctrl+Alt+L - Reformat Code) doesn't work for you try to change your settings:

     Settings->Editor->Code Style->XML->Android->Layout Files->Wrap Attributes