Home:ALL Converter>Android supporting all tablets - categorize drawables and layouts

Android supporting all tablets - categorize drawables and layouts

Ask Time:2013-01-04T12:33:30         Author:Krishnabhadra

Json Formatter

I have seen many thread discussing this problem in stackoverflow (like this, this and this), and I have read the documentation about supporting multiple screens, and designs. But I am still not clear about the folder structure for drawables and layout for different screens

I am working on an app that support android phone and tablets. And my project showing some images, which need to be shown in good quality in all possible android devices. And I need to tell my designer to design for all these resolutions.

From the documentation it seems I should add drawables for following resolutions (drawable folder name is given at the end),

1) 240 x 320  - Phone LDPI  -> drawable-ldpi

2) 320 x 480  - Phone MDPI  -> drawable-mdpi

3) 480 x 800  - Phone HDPI  -> drawable-hdpi

//Now for tablets

4) 1024x600   - Tablet LDPI -> ??

5) 1280x800   - Tablet MDPI -> ??

6) 1536x1152  - Tablet HDPI -> ??

7) 2560x1600  - Tablet XHDPI-> ??

From supporting multiple screens documentation, it seems I can use folders like

1) drawable-sw600dp  ( a 7” tablet (600x1024 mdpi).)
2) drawable-sw720dp   (a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).

But what about tablets with resolutions in the range of 1536x1152, 2560x1600 etc.. the 10' resolution range (720 x 1280 etc)seems small for them.. My client has a Nexus 10 with resolution 2560×1600 and I want my app to look perfect on it..

I know about, nine patch images, layout using wrap_content and other good practices like that. But for this project, I have some images which, as per requirement, should be seen lazer sharp on all common screens, and I need several versions of those images at least in my bundle.

So what and what resolutions should I mention to the designer? And how can I categorize them in bundle giving correct folder name.

Author:Krishnabhadra,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14151121/android-supporting-all-tablets-categorize-drawables-and-layouts
Mohammed Azharuddin Shaikh :

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.\n\nyou can use SW smallest width concept to target that, see Application Skeleton to support multiple screen and make calculation for the same.\n\nTablet Tablets are categorized into two size.\n\n\n 7\" (1024X(600-48(navigation bar))) = 1024 X 552 (drawable-large)\n 10\" (1280X(800-48(navigation bar))) = 1280 X 752 (drawable-xlarge)\n\n\nand for 2560x1600 calculate SW dp with formula\n\n\n px= Device's width\n dpi= Device's density\n\n\nformula given\n\npx = dp * (dpi / 160)\n\n\ninterchange formula if you have px's value\n\ndp = px / (dpi / 160)\n\n\nso drawable-swxxxdp will do the job",
2013-01-04T04:42:09
S.D. :

AFAIK there are two kinds variables for device display : pixel density and screen dimensions.\nBoth are theoretically independent, though in market both vary together from low end to high end devices. \n\nPixel density demands for different bitmap resolutions and level of detail (36X36 to 96X96 icons for example) .\n\nScreen 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.\n\nSo: \n\n\nTo cover most pixel densities you will have to have different\nversions of drawables : ldpi,mdpi,hdpi and xhdpi. Prefer nine-patch drawables, these are a lot better at fitting everywhere. \nTo 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.\nAndroid lets you mix configuration combinations too. E.g. drawable-large-hdpi etc.\nAvoid hard coded pixel co-ordinated and dimensions at all costs, use density or percentage.\nIts Way better to have one flexible nine-patch drawable than to have different drawables for different screen sizes.\n",
2013-01-04T04:52:17
Sakthimuthiah :

We can also use xxhdpi for drawables like drawable-xxhdpi\n\nxxhdpi (480dpi, Android 4.1 or later)\n\nOr refer \"Android Tabular Column\" in the follwing link\n\nhttp://en.wikipedia.org/wiki/Smartphone",
2013-04-01T07:20:59
Yar :

What I have come to use is:\n\n\none layout folder (or second one: layout-land)\na few values folders with dimens.xml (-hdpi, -large, -xlarge) for different sizes, fonts etc.\ndrawables: -hdpi with most images, they scale down for all the phones; -large for 7\" tablets; -xlarge for 10\" tablets. Or just -hdpi and -large.\n\n\nI might verify this approach, i.e. use -sw600dp and -sw720dp but for now it works.",
2013-02-14T08:36:19
yy