I am designing a background for my app for all Android devices.
I was thinking what would be the size of the image in pixels?
From the developer site I found the following equation
px = dp * (dpi / 160)
Then, px depends on two variables.
First, dp, and we have
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
Second, dpi and we have
low-density (ldpi) screens (~120dpi).
medium-density (mdpi) screens (~160dpi).
high-density (hdpi) screens (~240dpi).
extra high-density (xhdpi) screens (~320dpi).
So where should I put my drawables in the Screen characteristic? I mean should I use "size" or "Density". If I classify my images using the "size" "dp", what is the dpi for these images?
and if I classify my images using the "density" "dpi", what is the dp for these images?
I am confused on how to finally size my images. Also, Maybe you can have a medium density screen with a large screen size, right?
There are many many different resolutions out there. For instance there could be 4 different devices which are:
640 px x 480 px
The difference is, some of these devices are mdpi, some are hdpi, xhdpi etc. meaning they could be described as "large", "medium" or "xlarge" screen types.
So, for an mdpi device which is 640x480dp the background would be 640x480px however, a device which is 640x480dp and hdpi would need a background which is 960x720px, you'll notice they're the same size "bucket" but have different densities and therefore different resolutions.
So, if you just want your background to fit as well as can be expected you'll need:
- large-xhdpi
- large-tvdpi
- large-hdpi
- large-mdpi
- large-ldpi
(then the same for normal)
- normal-xhdpi
- normal-tvdpi
etc etc etc.
You're best bet however is to use an image which can stretch, a shape, tile or can be converted to a 9-patch because it would be a pain in the rump to make every background available for every device. If you were going to do it I would look up a resource descrivbing every screen dimension on the market currently and setting it via programmatic methods.