Why my Android device is applying sw410dp styles when it is 480dp?

42 Views Asked by At

I am testing an Android app in different screen sizes. For that, I have created dimensions for 360dp, 390dp, 410dp and 480dp (also have a default values.xml).

I was testing and adjusting styles on emulators and everything was OK. However, when I tested this on a Motorola g22 physical device, the styles are broken.

I have researched in Google and it has a 720px x 1600px, 6.5 inches. It is a hdpi (1.5 dpi).
So, applying the equation I found in this blog

px = dp * dpi / 160 = dp * hdpi

dp = px / hdpi

dp = 720 / 1.5

dp = 480dp

To be sure, I manually created an emulator hardware profile with that same resolution and it effectively has 480dp.
enter image description here

Due to a couple of tests, I discovered it is applying the dimensions from the 410dp but couldn't find the reason why.

On the other hand, the 480dp emulator I have been using for testing is Galaxy A12. It has the same characteristics but, in this case, the 480dp dimens are applied correcly.

Any idea why it is happening?

0

There are 0 best solutions below