Adi
Adi

Reputation: 197

Identify devices uniquely with same density and screen size category but different screen size in inches

Hi Ive been creating UI's for quite some time based on screen densities and screen size categories.

Now I have a weird situation where I have an Android Tablet(8 inches) and a HP Slate(21 inches) with MDPI density and X-Large screen size category.

Can someone please guide me on how the UI's could be created for these devices uniquely though they have the same Android UI specs?

Upvotes: 0

Views: 39

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007554

I have a weird situation where I have an Android Tablet(8 inches) and a HP Slate(21 inches) with MDPI density and X-Large screen size category.

IMHO, your Android tablet is messed up, as an 8" tablet should be -large, not -xlarge. That being said, your underlying point would be valid for, say, a 10.1" tablet, compared with the HP Slate, Samsung Galaxy View (18"), etc.

Also, the Slate 21" really should be -ldpi, but let's assume that HP elected to categorize it as -mdpi.

Can someone please guide me on how the UI's could be created for these devices uniquely though they have the same Android UI specs?

Ignore -large and -xlarge, as they have been obsolete for a while.

Instead, use -wNNNdp, -hNNNdp, and -swNNNdp qualifiers, where NNN are values that you choose, measured in density-independent pixels (dp).

An 8" -mdpi tablet will have a modest resolution (e.g., WXGA, 1280x720). The HP Slate 21" has a 1080p display (1920x1080). 1dp==1px for -mdpi devices, so the 8" tablet has a width of 1280dp and the Slate 21" has a width of 1980dp.

So, res/layout-w1800dp/, for example, would be picked up by the Slate 21" but not your 8" tablet, as the current width of the 8" tablet will not be 1800dp or larger.

Upvotes: 1

Related Questions