Android tablet screen sizes and layout folders for it - android

I have mobile app and I'm starting to implement the tablet version.
But I have small problem: Design of mobile app version is better for 7" (ex Nexus 7) devices than the tablet design.
So I would like to implement tablet design for devices >7".
I know that Nexus 7 using layout-sw600dp layout folder, and I guess I need to implement UI for tablet starting from layout-sw720dp layout folder. Is it good idea ? Or there is another folder after layout-sw600dp.
If there are devices which are > 7" and layout folder is 'layout-sw600dp' ?

Building a responsive UI in android is a long story to tell. You need to chose:
when to change
what to change
You can read this article : Article Link

It is not good practice to create different layout folders for different density devices. You should create a common layout that should be managed by different dimensions(means dimens.xml) for different density devices.
values-hdpi
--->dimens.xml
values-mdpi
--->dimens.xml
values-xhdpi
--->dimens.xml
values-xxhdpi
--->dimens.xml
values-xxxhdpi
--->dimens.xml
values-sw480dp
--->dimens.xml
values-sw600dp
--->dimens.xml
values-sw720dp
--->dimens.xml

Related

drawable-mdpi folder for handsets and tablets

I am developing an Android application for handsets and tablets. I have images in drawable-mdpi folder for handsets, I have an mdpi tablet that gets resources from drawable-mdpi. How can I make difference between mdpi handsets and mdpi tablets?
simply do it with dimen
for Handset use default values dimens.xml
values-sw600dp for 7 inch Tablate add dimens.xml
values-sw720dp 10 inch Tablate add dimens.xml
also create drawable-sw600dp and drawable-sw720dp
You will find solution in these two links.
For understanding drawable folder properties here
For differentiating tablets and devices here
Hope this helps.

Android picking images and styles from different resouce folders

I am developing an android application targetting for tablet devices as well as mobile devices
For that I have created my layout files like below
For Placing Screens:
res
layout-small
layout-large
For placing images to fit tablets and mobile devices:
res
drawable-ldpi
drawable-mdpi
For Placing Styles and String xml files:
res
values-small(strings.xml and styles.xml)
values-large(string.xml and styles.xml)
are there any extra folders need to create my application to work for tablet screens as well as mobile screens ?
but when i run the application in nexus7 emulator and nexus one emulator i'm not able to pick properimages and styles from respective xml files
could any one help?
change your layout-large and layout-small folder to
layout-sw720dp to support 10"+ tablets
layout-sw600dp will support 7" tablet.
Most of the Tablets will take image from mdpi folder
It is a complicated question and it depends on your desing and layouts.
In general there are more qualifiers to use.
For density there are also hdpi, xhdpi, xxhdpi. For size - normal, xlarge. For orientation - land, port. And you can combine any of those in one folder. For example res/drawable-mdpi-xlarge or res/layout-hdpi-large and so on. And it all depends on design and how you want to display layout on different screens.
For more information check this docs page http://developer.android.com/guide/practices/screens_support.html
if you are testing your application on an emulator, then check the properties of your emulator like which device you have chosen and its DPI and whether if it is hdpi, mdpi
These properties are there when you choose a device while creating a new emulator.
You cannot put same resolution images in all the drawable folders.
Please look into this. you will get a more clear picture.
Visit :- Support Multiple Screen - Android Developer

how to differentiate 7" (1024*600) tablet and 10.1" (1280*800) tablet at design time

I am developing app for tablets which supports 7" 1024*600 resolution and 10.1" 1280*800 resolution. So in order to differentiate them I am making folder layout-large-mdpi for 7" and layout-xlarge-mdpi for 10.1". But while I run the app, it runs from layout-xlarge-mdpi folder for both the device. Can anyone please guide me on how to differentiate these two tablets through folders in xml?
Make two different for layout also one layout for 7Inch as layout-sw600dp and for 10'inch as layout-720dp. and in the images make drawable also as drawable-large-hdpi(7Inch) and drawable-xlarge-mdpi(10Inch).

With Android, is it possible to have different layouts for phones and tablets?

ok, I know that most current phones and a 7 inch tablet are both considered "large" as far as screen size according to Android. But there's a big difference between a "large" phone with 480x800 pixels and a "large" 7 inch tablet with 800x1280 pixels. I've created separate layouts for those two sizes, but I still haven't wrapped my head around how to get the phone to see the 480x800 layout and have the tablet see the 800x1280 layout. I've tried tweaking the res folder names to things like layout-large-hdpi and layout-large-mdpi, and also leaving the smaller phone layout as layout and the larger, tablet layout as layout-sw600dp as the Declaring Tablet Layouts for Android 3.2 page suggests, but the problem there becomes Android is still looking in the drawable-hdpi for the phone sized images. So the question then is: How do I declare the phone layouts, and have the phone layout look in the phone drawables folder, and declare the tablet layout and have the layout look in the tablet drawables folder? I'm targeting Android 3.2 with this app that I'm working on.
Sounds like you're on the right track.
Stick your phone layouts just in "layout".
Stick your 10" tablet layouts in "layout-sw720dp"
Then use "layout-sw600dp" for targeting 7-inch devices.
You can use the same suffixes for the drawable folders to, so drawable-sw600dp would be targeted at 7" devices. [Reference].

How to create different layout for Galaxy S3 and Nexus 7?

I have created an android application which works properly for nexus 7.
Inside resources folder, I have created two folders, layout, layout-land for Nexus 7" tab. Everything was working fine till date. Now I want to create a different layout for Samsung Galaxy S3. For that, I have created a folders inside resources with layout-large & layout-large-land. But, here is the problem. Now, for Nexus 7 also, the layout defined in layout-large folder is getting loaded. How to stop that? How can I create different layout for Nexus 7" tab & Galaxy S3 mobile? I have read Supporting Multiple Screens documentation. But I couldn't understand as the screen size for Nexus 7 is 1204 X 800 & screen size for samsung galaxy S3 is 720 X 1280.
How to create different layouts for different devices with different screen resolutions & display sizes? Also, based on device size, I want to change few values in my application. How to do that one?
According to the Supporting Multiple Screens
Qualifiers like small, normal, large and xlarge is for Screen Sizes, which means Nexus 7 will use the resources with large qualifier, if you provide. Therefore before you create the folder with large qualifier, Nexus 7 will load the resources from default layout folder. As for ldpi, mdpi, hdpi and xhdpi is for the screen density.
To solve your problem, you need:
put the layout definitions for Galaxy S3 into layout, and layout-sw600dp for Nexus 7. Please refer to Android Developers Blog: Getting Your App Ready for Jelly Bean and Nexus 7
put the resources (images or drawable stuff) for Galaxy S3 into drawable-xhdpi, and drawable-tvdpi or drawable-hdpi for Nexus 7.
Hope it could help you, and please let me know if you have any other problems :)
Here are some useful references:
What layout is suitable for 720x1280 Android devices?
Screen Width Qualifier
You need one for xlarge and xlarge-land aswell
Or you can do it programmatically by calling:
Display displayparm= activity.getWindowManager().getDefaultDisplay();
int width= displayparm.getWidth();
int Height= displayparm.getHeight();
and choosing layout from this info
you could create the layout by adding new folder under the res folder as layout-xlarge and layout-xlarge-large and u have to update the android manifest file as well to support the for higher resolution
I have developed an application where i support multiple devices with different resolution and densities. with nexus 7 and galaxy s3 also one among them. galaxy s3 and nexus7 will obviously take from the large screen folder if u have layout-large folder in your project. But galaxy s3 falls under large hdpi category and nexus7 falls under large-tvdpi category. so it will be of great use if you have layout-large-hdpi and layout-large-tvdpi for s3 and nexus7 respectively.

Categories

Resources