jQuick jQuick - 10 days ago 5x
Android Question

Nexus 5X uses incorrect dimens bucket

From Nexus 5X spec it has 411x731 dp screen size.

How I understand that:

If I want recycler view with 2 column in portrait mode I should define column_count value in dimens.xml

<integer name="column_count">2</integer>

If I want recycler view with 3 column in landscape I should define column_count value = 3 in w-720dp dimens.xml. But it does not work. Recycler view has only 2 column.

But if define column_count value = 3 in w-600dp dimens.xml it works.

I don't understand why my nexus 5X uses values from w-600dp bucket in landscape while it has 731 dp screen width when in landscape.

Thank You!


For an mdpi device 1dp = 1px, and mdpi corresponds to 160 lcd density. The Nexus 5x has an lcd density of 480 (as specified in /system/build.prop), so on that device 1dp = 3px (because 480/160 = 3). The screen dimensions are 1920x1080 pixels, so divide by 3 and you get 640x360 dp (or 360x640 dp in landscape). Seems to me the device is acting perfectly fine.

Generally speaking, -w720 or -sw720 matches large tablets, and -w600 or -sw600 matches smaller tablets (and sometimes very large phones).