0

I know I need to use different DPI for images and all graphics stuff, but I just don't understand if I have to create the different drawable folders by myself or if there's a proper way to do it, and plus, what to use them for.

For instance I need to add a wallpaper, where should I put it? And of what resolutions? What are the pixels needed for each?

Tried to read the Google page about this, but didn't get much, thank you!

FET
  • 942
  • 4
  • 13
  • 35

2 Answers2

0

I have to create the different drawable folders by myself or if there's a proper way to do it?

Assuming you're using Android Studio:

enter image description here

enter image description here

enter image description here

what to use them for.

from http://developer.android.com/guide/practices/screens_support.html:

  • xlarge screens are at least 960dp x 720dp
  • large screens are at least 640dp x 480dp
  • normal screens are at least 470dp x 320dp
  • small screens are at least 426dp x 320dp

In that page you have documentation for screen sizes and densities. Basically, when you put, let's say, an image in an activity, it will render according to the device's density corresponding folder.

a wallpaper, where should I put it?

The best is to have an image for each density, but if you don't have those provided, you can put it in the drawable folder, without any density qualifier, which means that your resource is the same for every screen density.

For a quick way of knowing your device screen stats, download ScreenInfo.

RominaV
  • 3,335
  • 1
  • 29
  • 59
  • Wow, thank you! But how much would the resolution be in pixels? – FET Feb 20 '16 at 22:45
  • @FET Refer to this http://stackoverflow.com/a/2025541/2819864 :) , let me know if I can help in anything else. – RominaV Feb 20 '16 at 23:27
  • Yeah one last thing, I'd like to know what are the main resolutions for android smartphones, so I can design the wallpaper for each one – FET Feb 21 '16 at 14:58
  • Mmmm I need to know the size (i.e 1080x720) – FET Feb 21 '16 at 17:26
0

"...I just don't understand if I have to create the different drawable folders by myself"

  • no, you don't have to, but you can.

"... if there's a proper way to do it"

  • If you right click on res then select new then select Image Asset, Android Studio has an Image Asset tool that guides you through the whole process. This is how you import various UI elements in their correct dpi and densities.

"... what to use them for"

  • This is upto you. But if you set an ImageButton to an drawable with various drawable resources for different screen dpi, the correct dpi drawable will be chosen according to the device's screen dpi when the app is running.

"wallpaper..?"

  • Put that in drawable-nodpi or just the regular drawable
Elvis Chweya
  • 1,532
  • 11
  • 19
  • Woah, thanks! But I've tried to do that and I can only create folders for launcher icons, activity bar or notification icons, maybe I've misunderstood something? – FET Feb 20 '16 at 22:46
  • For other drawables, you right click on `res` and select `new` then `Drawable resource file`. In the `New Resource File` dialog box, select `Density` and then chose the desired dpi. – Elvis Chweya Feb 20 '16 at 22:56
  • Should this create the drawable folders? – FET Feb 20 '16 at 22:58
  • On the other hand, you can manually create folders under the `res` folder in Explorer with appropriate names, which is `drawable` followed by the screen dpi...e.g. `drawable-hdpi` or `drawable-xhdpi` and so forth – Elvis Chweya Feb 20 '16 at 22:59
  • Oh, yeah. Thank you! – FET Feb 20 '16 at 22:59
  • You solved the issue too! Just set the tick to the earlier answer: thank you both! – FET Feb 20 '16 at 23:00