Android Studio: Drawable Folder: How to put Images for Multiple dpi?

后端 未结 11 1760
旧巷少年郎
旧巷少年郎 2020-11-27 11:21

Hi as per android documentation the drawable folder needs to have multiple sub-directories for images of different dpis. However in Android Studio creating any sub directory

相关标签:
11条回答
  • 2020-11-27 11:57
    1. Right click "drawable"
    2. Click on "New", then "Image Asset"
    3. Change "Icon Type" to "Action Bar and Tab Icons"
    4. Change "Asset Type" to "Clip Art" for icon & "Image" for images
    5. For Icon: Click on "Clip Art" icon button & choose your icon
    6. For Image: Click on "Path" folder icon & choose your image
    7. For "Name" type in your icon / image file name
    0 讨论(0)
  • 2020-11-27 11:58

    You don't create subfolders of the drawable folder but rather 'sibling' folders next to it under the /res folder for the different screen densities or screen sizes. The /drawable folder (without any dimension) is mostly used for drawables that don't relate to any screen sizes like selectors.

    See this screenshot (use the name drawable-hdpi instead of mipmap-hdpi):

    enter image description here

    0 讨论(0)
  • 2020-11-27 11:59

    The standard procedures are:

    1. Choose Project > app > scr > main
    2. Right click "res", choose "New" and choose "Android resource directory"
    3. In the opened dialog, at Resource Type choose "drawable"
    4. In the list Available qualifier choose Density, then click the right arrow at the middle.
    5. Choose the Density that you like then press OK
    0 讨论(0)
  • 2020-11-27 11:59

    Simply go to project Explorer and change your View from Android to project from drop Down and you are good to go.There you can simply create folder like we do in Eclipse. And in android project view it is hidden but when you switch to project. You can create folder like drawable-hdpi,drawable-xhdpi.

    0 讨论(0)
  • 2020-11-27 12:00

    You need to access image IDs using R.mipmap.yourImageName

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