Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Rearranging XML in code style not working

So I'm trying to configure in Settings--> Code Style --> XML how I would like the order of the attributes to be sorted when reformatting the code using ctrl+shift+L on Windows. In my case, first all xmlns and other namespace attributes and then all the specific views attributes.
In order to do so, I tried playing with the rules preconfigured in the code style settings, and also by creating new rules. By default, first xmlns tags are shown, then view attributes, and then tools:..., as shown in the image here: enter image description here When going to Settings--> Code Style --> XML, I tried playing with the preconfigured rules and even tried creating a new rule, but didn't manage to get the tools:... attributes to be displayed after the xmlns attributes.
This is an image of the code style settings screen, also with the rule, I tried to create.
enter image description here Just to make sure, this is what I'm trying to achieve:
enter image description here
I also trying going over and over the documentaion but couldn't quite figure out how to properly create the rule, since it's not working.
XML code style documentaion
Has anyone tried changing these settings, and/or can help me with the setting?

Thank you

like image 987
Roy Hen Engel Avatar asked Oct 17 '17 22:10

Roy Hen Engel


1 Answers

Found the answer:
1. Add a new rule
2. In my case:
Name = tools:.*
Namespace = .*
3. Done!

like image 185
Roy Hen Engel Avatar answered Sep 27 '22 18:09

Roy Hen Engel