Levon
Levon

Reputation: 250

Can't wrap my head around android drawable folders mdpi, xhdpi

I can't wrap my head around the folders mdpi, hdpi, xhdpi and xxhdpi, are they meant for every kind of images or only for icons? The sizes in which my images are stored in there are really small, as you can see in this cheatsheet (click to enlarge):

cheatsheet

xhdpi is 96px. In my app 96px looks really blurry (click to enlarge):

blurry

So how should I store my image then?

Upvotes: 0

Views: 116

Answers (2)

Anshul
Anshul

Reputation: 79

Drawable folders are meant for all kind of images. hdpi,mdpi,xhdpi,xxhdpi.xxhdpi are generally used to cover each and every device available in the market place. nodpi folder is used to store images that can be used in any resolutions

For adding app icon try using the mipmap folders with all these above qualifiers for different size.

placing correct size images in correct folder will definitely work.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006839

the folders mdpi hdpi xhdpi and xxhdpi, are they meant for every kind of images or only for icons?

Most bitmap drawable resources should get density-specific versions, at least for a few densities.

as you can see in this cheatsheet xhdpi is 96px

I see nothing in there saying that every image must be 96px for xhdpi. The standard action bar height and tab bar heights for xhdpi are 96px. That's it.

In my app 96px looks really blurry.

That image should have a higher resolution, as you are using it in a UI element that is far larger than the action bar or a tab bar.

So how should I store my image then?

Step #1: Determine your desired size for the image, in inches.

Step #2: Determine the resolution for the image in dp, by multiplying the size in inches from Step #1 by 160.

Step #3: Choose what densities you want to create specific artwork for. You might use the "Screen Sizes and Densities" section of the Android device dashboard to give you some ideas.

Step #4: Determine the density-specific resolution for the image in px, for the densities from Step #3, by multiplying the dp value from Step #2 by the size factor shown in the upper-left infographic of that cheatsheet.

Step #5: Create drawable directories for the densities from Step #3 and create your artwork in those, sized based on the values from Step #4.

Upvotes: 1

Related Questions