After updating to Android Studio 3.2.1 the XML files format is very annoying and bad, how can we fix it? Can we change it from somewhere in settings to previews type?
No, the indentation does not matter in XML documents.
To turn it on or off for the Text editing mode,open the Preferences dialog box (Options > Preferences), go to Editor > Format > XML, and select/deselect the Schema-aware format and indent option.
By default, the formatter will use the Android-defaults for indentation: 4 space characters. However, there is a setting for turning this off and making the indentation use the Eclipse XML indentation settings instead (which defaults to one tab character). Here are the current options related to the XML formatter:
We are going to discuss three different methods with the help of which we can format the code in our Android Studio. In this method, we simply have to navigate to the file in which we have to format our code. After opening the file we have to simply press the shortcut key as Ctrl+Alt+L to reformat the code in your file.
In the Settings window, navigate to Editor > Font. Increase the font size. Click OK. This section describes known issues related to the code editor. There are some known interactions between the iBus daemon on Linux and Android Studio.
The Android Eclipse plugins now provides its own custom XML formatter. This formatter replaces the default Eclipse XML formatter, but there is a setting you can uncheck to revert to the default Eclipse XML formatter. The new formatter basically formats the XML the "standard".
On Android Studio 3, Go to :
Preferences > Editor > Code style > XML then on Scheme switch to Default instead of Project.
You can then use those shortcuts to indent your code:
Windows:
Ctrl + Alt + L
macOS:
Option + Command + L
You can edit your code styles under File > Settings > Editor > Code Style > XML
If you want to preview a specific file, just paste that file's contents into the preview window.
Open File > Settings > Editor > Code Style > XML
Now in layout file make sure you have selected wrap attributes as Wrap always.
Screenshot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With