Android supporting all tablets - categorize drawables and layouts Android supporting all tablets - categorize drawables and layouts android android

Android supporting all tablets - categorize drawables and layouts


Actually Tablets are categorized by size not by dpi, i.e 7" tab is drawable-large while your 10" tab is drawable-xlarge. And now you can again categorized by dpi like drawable-large-hdpi which means it is a Tab of 7" which having High Density.

you can use SW smallest width concept to target that, see Application Skeleton to support multiple screen and make calculation for the same.

Tablet Tablets are categorized into two size.

7" (1024X(600-48(navigation bar))) = 1024 X 552 (drawable-large)
10" (1280X(800-48(navigation bar))) = 1280 X 752 (drawable-xlarge)

and for 2560x1600 calculate SW dp with formula

px= Device's width
dpi= Device's density

formula given

px = dp * (dpi / 160)

interchange formula if you have px's value

dp = px / (dpi / 160)

so drawable-swxxxdp will do the job


AFAIK there are two kinds variables for device display : pixel density and screen dimensions.Both are theoretically independent, though in market both vary together from low end to high end devices.

Pixel density demands for different bitmap resolutions and level of detail (36X36 to 96X96 icons for example) .

Screen dimensions demand for better use of real estate ( Multi activity layout for phones, combined fragmented layout for tablets, for example). Not as important as pixel density, but good to have, because tablet users might find a phone layout too bland, and waste of screen space.

So:

  • To cover most pixel densities you will have to have differentversions of drawables : ldpi,mdpi,hdpi and xhdpi. Prefer nine-patch drawables, these are a lot better at fitting everywhere.

  • To cover most screen sizes you will have to have different layout arrangements, and a responsive layout design for small,large and xlarge values. Also, different layouts for portrait, and landscape orientations are good to have sometimes.

  • Android lets you mix configuration combinations too. E.g. drawable-large-hdpi etc.

  • Avoid hard coded pixel co-ordinated and dimensions at all costs, use density or percentage.

  • Its Way better to have one flexible nine-patch drawable than to have different drawables for different screen sizes.


We can also use xxhdpi for drawables like drawable-xxhdpi

xxhdpi (480dpi, Android 4.1 or later)

Or refer "Android Tabular Column" in the follwing link

http://en.wikipedia.org/wiki/Smartphone