Reputation: 835
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 in the drawable folder causes it to fail to detect any images at all. On the other hand if an image is placed directly in the drawable folder it gets detected and becomes available for use view R.drawable.ImageName. In this case how do we use different dpi images for the same ImageName?
Upvotes: 70
Views: 172955
Reputation: 147
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...
Upvotes: 0
Reputation: 369
New -> Batch Drawable Import -> Click on Add button -> Select image -> Select Target Resolution, Target Name, Format -> Ok
Upvotes: 0
Reputation: 22018
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 selector
s.
See this screenshot (use the name drawable-hdpi
instead of mipmap-hdpi
):
Upvotes: 14
Reputation: 1791
The standard procedures are:
Upvotes: 158
Reputation: 151
The easiest way I have found to have the proper "directory" structure appear under the drawable folder for my icons is this:
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.
Upvotes: 15
Reputation: 34360
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
.
Upvotes: 11
Reputation: 3356
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
Now yourprojectname->app->src->main->res->
Aila You can see your drawable folders with hdpi mdpi etc.
Upvotes: 26
Reputation: 3588
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
Upvotes: 2
Reputation: 1560
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.
Upvotes: 1