banner



How To Create Different Drawable Folders In Android Studio

12 Answers 12

answered Mar 25 '16 at 8:50

5

  • Even after doing this, I still cannot access the images!!

    Nov 26 '16 at 18:57

  • Amazing answer. Thanks!

    Jul 13 '17 at 6:39

  • The method to add a folder is correct. I appreciate that. However to access the folder, you will have to change the Project Structure View from Android to Project. Here navigate to res->xxhdpi @Fattie

    Nov 16 '17 at 20:47

  • @Fattie you can access by @drawable/your_file_name , it will automatically pick your file from drawable-xxxhdpi (in my case).

    May 10 '18 at 11:41

  • There is no drawable resource type to create drawable directory(atleast in latest version in windows)

    Jul 27 '20 at 8:23

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.

answered Mar 27 '15 at 6:26

1

  • first way only adds icons

    Aug 10 '17 at 7:28

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

answered Mar 27 '15 at 6:11

5

  • Yes we need Sibling Folders not the folders below the drawable folders. This is the detail I missed in the documentation. Thanks for pointing out @Ascorbin

    Mar 27 '15 at 7:17

  • This is so utterly and completely confusing, I wish I was still doing it manually. In the android file explorer I have drawable-hdpi and all those folders but I can't access them even though they have images in them I never placed there. In my OS wm I don't have any of these, so I can't check the sizes and my app is slow so I doubt it's working properly. I'm just going to have to manually look up the pixel per dpi per folder and then scale everything and hope that fixes it instead of loading the broken hidden folders. Good thing programmers don't have anything better to do than resizing fml

    Jun 21 '15 at 8:07

  • I can see an image in hdpi and mdpi but when I preview all resolutions in the designer all I see is the hdpi image. How do I dell andriod "Display image I on resolution R"

    Mar 3 '16 at 23:36

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.

answered Mar 8 '16 at 7:04

1

  • Thanks, your way is easy and quickly.

    Jul 10 '18 at 15:21

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.

enter image description here

answered Mar 5 '16 at 10:01

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

answered Jun 25 '15 at 10:05

1

  • This will work only if you have the folder already exists in drawable.

    Nov 9 '18 at 4:28

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.

answered Mar 27 '15 at 6:19

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

answered Jul 4 '15 at 6:04

1

  • This is the only answer that suggests how to access the images and it has been marked down. None of the answers here say how and image is chosen. It appears to happen by magic.

    Mar 3 '16 at 23:30

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

answered Oct 31 '17 at 9:28

  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

answered Jun 17 '19 at 8:00

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

answered Dec 14 '19 at 12:50

Simply upload image to any online tool converter that will convert your image to different dpi(s) and then download and copy and paste from downloaded dpi folders to Android dpi folders. For example, I have logo image to convert into different dpi(s), I searched in Google for online image converter into different dpi s, and then uploaded that imag and downloaded zip folder which contains different dpi folders, from which I copied one by one and pasted into same Android dpi folders. That is done...

answered Aug 14 at 5:19

Not the answer you're looking for? Browse other questions tagged android android-studio android-drawable or ask your own question.

How To Create Different Drawable Folders In Android Studio

Source: https://stackoverflow.com/questions/29294287/android-studio-drawable-folder-how-to-put-images-for-multiple-dpi

Posted by: vangentler63.blogspot.com

0 Response to "How To Create Different Drawable Folders In Android Studio"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel