How to create new res folder in Android Studio

前端 未结 7 634
难免孤独
难免孤独 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).

提交回复
热议问题