Home » Android » Android Studio 3.5 – Formatting (ctrl+Alt+L) the code in XML file is rearranging the Views in the LinearLayout

Android Studio 3.5 – Formatting (ctrl+Alt+L) the code in XML file is rearranging the Views in the LinearLayout

Posted by: admin May 14, 2020 Leave a comment

Questions:

Recently I have updated to Android Studio 3.5. I have three views: an EditText, a TextView and a Button inside a vertical LinearLayout(ViewGroup) named sample.xml file.
When I format the stuff by pressing ctrl+alt+L, all the views get rearranged automatically. In my case the Button view which is in the bottom has reached to top after formatting, also EditText and TextView which is in top first and second are rearranged in second and third position respectively in vertical LinearLayout.

Android Studio : 3.5

Android Gradle Plugin: 3.5.0

Gradle: 5.4.1

JRE: 1.8.0_202-release-1483-b03x64

OS: Windows 8.1(amd64) v6.3

How to&Answers:

Please try below settings that worked for me

Settings -> Editor -> Code Style -> XML-> Set From -> Predefined Style > Android.