How to create new res folder in Android Studio

前端 未结 7 627
难免孤独
难免孤独 2020-12-08 05:22

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 creat

相关标签:
7条回答
  • 2020-12-08 05:22

    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".

    enter image description here

    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.

    enter image description here

    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.

    enter image description here

    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).

    0 讨论(0)
  • 2020-12-08 05:28

    The values-xx folder we created is not showing, but when we create a file its asking =>I have created values-21 folder and then tried with creating an xml and it asks for choosing a directory =>I have updated to Android 1.02

    Check the values-21 Sample

    0 讨论(0)
  • 2020-12-08 05:39

    If you have already created a new directory but just don't see it in the Project Tools window. Do this

    Click on Project Tools window >> Android(Drop Down) >> Click Project. Now you'll see all your Directories in res. See the picture:

    enter image description here

    0 讨论(0)
  • 2020-12-08 05:43

    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.

    0 讨论(0)
  • 2020-12-08 05:44

    Its very simple. I too had trouble initially. 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!! It works for a fresh project everytime!

    0 讨论(0)
  • 2020-12-08 05:45

    This bug is fixed in newer versions of Android Studio.

    0 讨论(0)
提交回复
热议问题