Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sort strings.xml alphabetically in Android Studio

Hello is there a way to sort the string names alphabetically in strings.xml ? It should sort it like this

Before

 <string name="ccc">CText</string>  <string name="aaa">AText</string>  <string name="bbb">BText</string> 

After

 <string name="aaa">AText</string>  <string name="bbb">BText</string>  <string name="ccc">CText</string> 

I am using Android Studio 1.5.1

like image 570
Murat Karagöz Avatar asked Feb 23 '16 08:02

Murat Karagöz


1 Answers

I used AndroidXmlSorter plugin and it works perfectly for me.

enter image description here

How to install: Go to Android Studio -> Preferences -> Plugins and hit Browse repositories.. Search for AndroidXmlSorter, install and restart your Android Studio. Go to your strings.xml file and hit Ctrl+L. Voila.

Disclaimer: I'm not the author of this plugin, I just found it by chance and I think all the credits should go to the plugin author. The repo is here: https://github.com/roana0229/android-xml-sorter

like image 127
Nicholas Lie Avatar answered Sep 28 '22 11:09

Nicholas Lie