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

后端 未结 11 1759
旧巷少年郎
旧巷少年郎 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:45

    There are two ways of doing it.

    1.Right click on drawable New->Image Asset-> select your highest resolution image rest will be created automatically. once you finish you can see different resolution inside drawable folder

    1. The way you want. on the project Explorer window you see a dropdown as Android. Click it change to project.

    Now yourprojectname->app->src->main->res->

    Aila You can see your drawable folders with hdpi mdpi etc.

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

    In android studio you may see the following folder drawable xhdpi, drawable-hdpi, drawable-mdpi and more... You can put images of different dpi in these folder accordingly and android will take care which images should be draw according to the screen density of device.

    NOTE: You have to put the images with the same name.

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

    The easiest way I have found to have the proper "directory" structure appear under the drawable folder for my icons is this:

    1. Right click "Drawable"
    2. Click on "New", then "Image Asset"
    3. Change "Asset Type" to "Action Bar and Tab Icons"
    4. For "Foreground" choose "ClipArt"
    5. For "Clipart" click and "Choose" button and pick any icon
    6. For "Resource Name" type in you icon file name

    Now the pseudo-directories have been created for you under the Drawable folder in the Android view. Open up the true directories on your file system "main/res/drawable-xxhdpi", "main/res/drawable-xhdpi" and replace the icons in each folder with your own of the proper density.

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

    0

    Right click "drawable" Click on "New", then "Image Asset" Change "Icon Type" to "Action Bar and Tab Icons" Change "Asset Type" to "Clip Art" for icon & "Image" for images For Icon: Click on "Clip Art" icon button & choose your icon For Image: Click on "Path" folder icon & choose your image For "Name" type in your icon / image file name

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

    simply copy and paste the image into res>drawable and it ask you destination folder which you want to pate resolution image for more help please look for Android Studio drawable folders

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

    New -> Batch Drawable Import -> Click on Add button -> Select image -> Select Target Resolution, Target Name, Format -> Ok

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