How does one get dimens.xml (sw600dp) into Android Studio?

前端 未结 2 804
轻奢々
轻奢々 2020-12-31 14:50

I inherited the values folder structure shown below.

For over an hour I\'ve Googled and looked and pulled down menus in Android Studio 1.2.2 an

相关标签:
2条回答
  • 2020-12-31 15:09

    I have had MANY failures trying to do stuff OUTSIDE Android Studio, but this time I got away with it:

    I will now see how @Commonsware says I could have done it.

    EDIT

    And as always, @Commonsware bailed me out with good advice (I have no idea when or why or how I lost the File structure "tab" along the left margin).

    Here's what I now see, and (I was right:) it's NOT hard to see what to do ONCE YOU SEE THIS:

    And, following his advice, I get to here and am ready to create the dimens.xml file that goes inside:

    0 讨论(0)
  • 2020-12-31 15:17

    What steps do I need to take to get a dimens.xml file with the swdp file naming convention?

    First, you will probably be happier with life if you change the drop-down above your project tree from "Android" to "Project", which shows you an actual filesystem view of your project.

    To add a resource directory from within Android Studio:

    1. Right-click over res/

    2. Choose New > "Android resource directory" from the context menu to bring up the New Resource Directory dialog:

    Android Studio New Resource Directory

    1. Choose your resource type in the "Resource type" drop-down (in this case, values)

    2. Click on your desired qualifier (in this case, "Smallest screen width") in the "Available qualifiers" list.

    3. Click the >> button

    4. In the field that appears, fill in your numeric value (in this case, 600)

    5. Click OK to close the dialog and create the directory

    To add dimens.xml to that directory, right-click over the newly-created directory and choose New > "Values resource file" from the context menu.

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