Screen Densities You Can Use When Programming Android Apps
Android devices come in many different pixel densities. Older phones came in mdpi- or ldpi-pixel densities. These days, most newer phones come in hdpi- or above pixel densities. But some tablets may still come in mdpi densities. Here is the list of densities Android supports:
ldpi (low): ~120 dpi (dots per inch)
mdpi (medium): ~160 dpi
hdpi (high): ~240 dpi
xhdpi (extra-high): ~320 dpi
xxhdpi (extra-extra-high): ~480 dpi
xxxhdpi (extra-extra-extra-high): ~640 dpi
You can use these densities as qualifiers in your drawables directory to provide different images for different density screens. For example, you can provide different sizes of assets for different devices by putting the image files in drawables-mdpi, drawables-xxhdpi, and so on.
In addition, you can use them as qualifiers on your values directories to utilize slightly different values for things like margin, padding, and text size on different sized devices. These values are typically put into a dimens.xml file in the corresponding values directory.
Remember, you do not necessarily have to provide all your images for all densities. A good rule of thumb is to provide the xxhdpi assets for all your images and rely on Android to automatically scale them down to the other sizes as necessary. But if there are some images that don’t look great when scaled down (such as a company’s logo for example), you may want to provide that asset at all densities.