I want to add localized strings for my android app. Therefore I need a values-xx folder in my Res folder.
The original values folder has a blue dot, so I tried creating a new Package, but a package can't contain a hyphen so this must be wrong. Instead I tried right-clicking res and choosing New -> Android resource directory, but this time nothing happens. No dialog or reaction of any sort as I can see.
How do I create a values-xx folder?
Edit: I can create the folder from file explorer and it all works good. It is just irritating to not be able to do it from inside Android Studio.
Edit2: This bug is fixed in newer versions of Android Studio.
In the drop down menu click on the new option. After this a drop down menu opens here you will see directory option just click on that. After this enter the name of your directory / folder and press enter this will create a new folder / directory inside your root folder.
The res/values folder is used to store the values for the resources that are used in many Android projects to include features of color, styles, dimensions etc.
Lets break it stepwise:- 1) Open your project 2) Right click the res folder 3) Choose New 4) Chose Directory 5) Name the directory. Thats it!!
When you are in the Android view (rather than Project or Packages) in Android studio, you just need to right click the "values" directory and choose New > "Values resource file".
That gives you a chose of different resources you can add. For example, if you want to add a different language to your app you can choose the Language option and press the ">>" button. If you want Swahili then select that from the list, type "strings" for the file name, and press OK.
Android Studio will automatically create a values-sw
directory with the new strings.xml file in it. And in your Android file view you conveniently see both strings files together.
And it is a similar process for adding other types of resources (see my other example). You no longer have to manually add the directories (but you can do that too by right clicking the res directory and choosing New > Android resource directory).
I had the same problem, what I did was create a values-xx folder inside the main directory (main>>right click>>new>>directory) and then moved that folder to res/ directory.
It's not beautiful but it is a workaround to create a folder with Android studio.
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