I've been researching SO and this blog in relation to creating correct layout folders for tablet design. I'm working on an application which will support larger phones and tablet 7/8/10 inch. All the research points to a layout folder of layout-sw600dp for 7inch and layout-sw720dp for 10inch. Am I right in understanding that the layout-sw600dp will cover anything from 7inch up to 10inch and then layout-sw720dp for 10inch +? Also my drawables are as follows hdpi/mdpi/xhdpi/xxhdpi I'm assuming that that these remain and no additional folders are required for tablets? Any infor would be appreciated
You can use : "drawable-sw720dp" for 10'' tablets, containing 720px-width images" for the 8" Tablet .
For more info you can refer here , as 8" is reside between 7-10 Range so that you can use 10" drawable folder
http://developer.android.com/guide/practices/screens_support.html
Related
I'm developing an app for android devices, but i have some problems with the variety of screen sizes and different densities. So I see that before android 3.2 the solution was to create 4 folders: Small, Medium, Large and xlarge, now this method is deprecated. The problem is though running the application in similar devices the layout looks different. Which and how much folders should i do?
This is what I did for supporting all screen sizes, it can be a lot of work:
Directories:
layout-sw320dp
layout-sw320dp-land (smallest phones, 3.7" and smaller)
layout-sw360dp
layout-sw360dp-land (approximately 4-4.7")
layout-sw400dp
layout-sw400dp-land (most phones right now, 5-6")
layout-sw600dp
layout-sw600dp-land (7-8" tablets)
layout-sw720dp
layout-sw720dp-land (9" tablets)
layout-sw800dp
layout-sw800dp-land (10" tablets)
The same applies to directory names for drawables:
drawable-sw320dp
drawable-sw320dp-land
etc etc .. that's the general idea
Google's docs mentions sw720dp for 10" tablets but if you want separate layouts for 9" and 10" I discovered sw720dp is 9" and sw800dp is 10"
Use the new Layout Aliases like this :
res/layout/main.xml: single-pane layout
res/layout-large: multi-pane layout
res/layout-sw600dp: multi-pane layout
But i think the most importing thing to adopt your layout to different screen sizes is to follow best practices for User Interface ( when to use wrap_content, match_parent RelativeLayout, LineareLayout, Qualifiers ... )
Here's a good tutorail to start with Supporting Different Screen Sizes
I'm trying to figure out how to define different layout for different screen density.
At the moment I have to manage a 7" (Nexus 7), 10" (galaxy tab S) and now a 9.7" (Galaxy tab A) tablets
So I've defined for now two layouts directories :
layout (for 7")
layout-sw720dp (should be only for 10")
My problem is the 9.7" tablet match the layout-sw720dp directory as my 10" tablet. So from this point I don't know how to define another layout directory based only on my 9.7" tablet.
The density of the 10" is 288ppi and the density of the 9.7" is 132ppi.
I guess if the density would be the same I wouldn't have this problem.
Is it possible to create a new directory layout based only on the density ? What is the best practice for this use case and manage at the same time my 10" layout and my 9.7" layout with a different density ?
you have two options for this either you use
layout-sw600dp
layout-sw720dp
layout-sw800dp
or use the dpi wise folder structure like this
drawable-land-mdpi
drawable-land-hdpi
drawable-land-xhdpi
drawable-land-xxhdpi
What I've done is instead of using layout-sw720dp I used these two layouts:
layout-hpdi for 10" with hight dpi
layout-mdpi for 9.7 with medium dpi
And it seems to work good.
Edit
Actually I kept layout-sw720dp and then I use also a value-hdpi and value-mdpi resource directories to manage at the same time screen size and density.
I am working in an android application and I want to support my application in all devices. But I don't know from which drawable folder 8 inch tablet takes images.
"drawable-mdpi" for mobiles, containing 320px-width images
"drawable-hdpi" for mobiles, containing 480px-width images
"drawable-xhdpi" for mobiles, containing 720px-width images
"drawable-sw600dp" for 7'' tablets, containing 600px-width images
"drawable-sw720dp" for 10'' tablets, containing 720px-width images
???? for 8'' tablets
You can use : "drawable-sw720dp" for 10'' tablets, containing 720px-width images" for the 8" Tablet .
For more info you can refer here , as 8" is reside between 7-10 Range so that you can use 10" drawable folder
http://developer.android.com/guide/practices/screens_support.html
"drawable-sw600dp" for 7'' tablets, containing 600px-width images
"drawable-sw600dp" is the folder that applies the drawable properties of device with minimum 600dp width.
So you dont need to worry about it.The android system will automatically suites drawable from sw600dp to 8 Inch Tablets
Have a Nice Day ....
The qualifiers hdpi,xhdpi,xxhdpi describes the screen density of the device, not the size of screen. From the official doc
The better practice is to put the following drawables
// for Phones
drawable-ldpi
drawable-mdpi
drawable-hdpi
//for 7 inch tablets
drawable-large-mdpi
drawable-large-hdpi(for Nexus 7)
// for 10 inch tablets
drawable-xlarge-mdpi
The drawable for 8" inches should be implemented if the App uses large background images where should be taken in a serious importance for memory allocation.
U can easily categorize your Drawables to large-mdpi, large-xhdpi , large-port-xhdpi(..) but u are in a situation where u delete the small , normal large and u implementing a swallest width of 600, 720 as any android delevopers will customize early or later.. I really suggest to implement an sw800 where has 1280 x 800!!! and also to make sure in your code to have an ifstatement where directly speaks throw the DisplayMetrics.Density and implements == to 800 widthPixels... This will give an HD performance if the images are recycling and are on in InBitmap to retain instance..
I need to support an application for bith mdpi, hdpi and xhdpi mobiles and 7' and 10' tablets I have to admit that I'm a bit lost.
So far I only did the tablet version and what I did is :
one single folder called "layout"
3 different folders called "drawable-sw600dp", "drawable-sw800dp" and "drawable-sw1200" containing images of 600px large, 800px large and 1200px large.
I have the impression that I messed it up and that I should have the created standard "drawable-mdpi", "drawable-hdpi" and "drawable-xhdpi" folders.
But if I do so :
in which folder do I have to put the images for the tablets? xhdpi only?
how large (in px) should be the images for the tablets?
how large should be the images for the mobiles?
and last but not the least : how to have to name the "layout" folders to have a different version for mobiles and tablets?
I already read the Android recommendation like a 1000 times and I am still confused...
EDIT 1
This paragraph from Android website answered my question "how to have to name the "layout" folders to have a different version for mobiles and tablets?"
EDIT 2
Regarding the drawable folders, for mobile phones, it seems quite clear that I have to create 3 folders this way :
drawable-mdpi containing 320px-width images
drawable-hdpi containing 480px-width images
drawable-xhdpi containing 720px-width images
Still remains the question of how to name the different drawable folders for supporting tablets.
so this would be my answer.
Layouts -> 2 folders :
"layout" (or "layout-sw320dp") for mobiles
"layout-sw600dp" for tablets
Drawables -> 5 folders :
"drawable-mdpi" for mobiles, containing 320px-width images
"drawable-hdpi" for mobiles, containing 480px-width images
"drawable-xhdpi" for mobiles, containing 720px-width images
"drawable-sw600dp" for 7'' tablets, containing 600px-width images
"drawable-sw720dp" for 10'' tablets, containing 720px-width images
Any better response than this one is welcome!
Because LDPI is barely used you should make 3 different sizes of images for mobiles.
Lets say you have an image which is 50x50 DP.
MDPI = 50x50PX
HDPI = 75x75PX (x1.5)
XHDPI = 100x100PX (x2.0)
You can create even more folders like: drawable-xlarge-xhdpi and drawable-xlarge-hdpiand put images you need for the tablets in there. I believe xlarge was for 10-inch? So you might end up with about 9 different sizes. 3 for mobile, 3 for 7' and 3 for 10'. Tablets also have pixel densities!
Right click your project in Eclipse -> New -> Other -> Android XML File
And then you choose Drawable as a recourse type to make drawable folders for example.
Below is a screenshot of how this looks. It's really useful!
Also see list of displays by pixel density
Using this you make folders that will look like this. large is 7', xlarge was 10' (I think).
/res/drawable-large-mdpi
/res/drawable-large-hdpi
/res/drawable-large-xhdpi
/res/drawable-xlarge-mdpi
/res/drawable-xlarge-hdpi
/res/drawable-xlarge-xhdpi
7 inch Android tablets are HDPI and large.
Check the table here and read about large/xlarge/small etc.
i have an application that am trying to implement it on a tablet 7'. this that i have done is the follow. on the folder drawable and layout are my defaults for the normal smartphone screen. also i have create the layout-xlarge and drawable-mdpi in which on the first one i have change the sizes and on the second one i add the images with different size. my problem is that the default get the size of images that i have on the drawable-mdpi folder and not from the default drawable folder. what am i doing wrong? also i have nothing declare on the manifest.
mdpi is the default, so drawable and drawable-mdpi are the same thing and I don't know which Android chooses in this case - but you're designing for a tablet and tablets are generally mdpi devices so it correctly gets it from drawable-mdpi. You could use drawable-xlarge-mdpi if you want separate mdpi resources to be used for extra-large screens. Incidentally, remember a 7" 1024x600 tablet is large, not xlarge - so try drawable-large-mdpi and layout-large-mdpi and see if that gives you what you want.