Search code examples
androidxmlandroid-studioandroid-studio-2.0reformatting

Android Studio XML reformat code ignores xmlns:.* attributes


Android Studio's reformat code ignores the first 2 Matching rules I've configured, rule for placing xmlns:android attribute as the first attribute and xmlns:.* attributes right below it.

My Matching rules: Matching rules

The code after reformatting: layout.xml

Are my rules right defined? Is this a bug in Android Studio?

I'm using Android Studio 2.0 beta 5.


Solution

  • So, I've got the answer thanks to my colleague.

    1. You have to set ALL the rules as attributes OR remove attribute flag in ALL of them.
    2. set .* as namespace for xmlns:.* rules

    Example: Matching rules