Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Correct Screen Density

I've come across with this table showing what Android uses as baseline for screen density: enter image description here

Here i understand that if my mdpi image is 100px, then i have to use 150px(1.5 factor) for hdpi.

Question 1: Does mdpi targets screen densities between 120dpi screen and 160dpi screen? Because my phone has 432dpi(or ppi) and it uses xxhdpi, so i thought xxhdpi targets screen densities between 320dpi and 480dpi, right?

But here i've came across with different table, showing example: enter image description here

Question 2: According to assumption above, xhdpi should target between 240dpi-320dpi, but in second table 336dpi is also considered as xhdpi, why? And what happens if user has screen density > 480dpi and i don't have xxxhdpi folder?

like image 643
Jemshit Iskenderov Avatar asked Dec 28 '25 02:12

Jemshit Iskenderov


1 Answers

Android picks the right density bucket for a given DPI value based on the bucket which has the least difference in DPI value.This can easily be seen in de following image:

DPI buckets

Quote:

Figure 1. Illustration of how Android roughly maps actual sizes and densities to generalized sizes and densities (figures are not exact).

Source: http://developer.android.com/guide/practices/screens_support.html#range

Question 1: Mdpi targets roughly anything between 140 DPI and 180 DPI.

Question 2: 336 DPI is considered xhdpi because the xhdpi bucket is the closest one (in DPI value: 6). The difference to the hdpi bucket is 96 and the difference to the xxhdpi bucket is 144.

When a density folder is missing Android picks the best alternative folder and if needed applies scaling to the resources to match the target density.

like image 127
Rolf ツ Avatar answered Dec 30 '25 16:12

Rolf ツ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!