drawable-mdpi folder for handsets and tablets - android

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.

Related

Android tablet screen sizes and layout folders for it

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

drawable-sw720dp vs drawable-hdpi, drawable-xhdpi and others

I want to provide drawables for:
hvga and qvga phones (but those use hdpi drawables pretty well)
hdpi phones
xhdpi phones
xxhdpi phones
7" tablets
10" tablets
I have folders:
drawable-hdpi (used by phones up to 480x854 screens)
drawable-xhdpi (used by phones like Galaxy S3)
drawable-xxhdpi (used by phones like Galaxy S4)
drawable-sw600dp (I would expect: used by 7" tablets)
drawable-sw720dp (I would expect: used by 10" tablets)
My original problem was, I thought resources from drawable-sw720dp are not used, but they are! Some graphic designer gave me files with different names and I did not notice. My fault.
So no problem at all.
For supporting tablets also, use large, xlarge qualifiers. Nexus 7 is a large-hdpi tablet(technically it's tvdpi, but takes images from hdpi). So if you want to put images for Nexus 7, make a folder named drawable-large-hdpi and put the images there.
Now regarding the 10 inch tablets case, they are xlarge devices and their densities can change from mdpi to xhdpi(Nexus 10). But many have resolution of 1280 * 800 and they are mdpi devices.
Create drawable folder like this
// for Phones
drawable-mdpi
drawable-hdpi
drawable-xhdpi
drawable-xxhdpi
//for 7 inch tablets
drawable-large-mdpi
drawable-large-hdpi(for Nexus 7)
// for 10 inch tablets
drawable-xlarge-mdpi
drawable-xlarge-xhdpi(for nexus 10)
Source of answer
My original problem was, I thought resources from drawable-sw720dp are not used, but they are!

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

Android drawable folder for <3.2 devices

I have a background image of different sizes, 240x320, 320x480, 480x800, 1024x600, 1280x720. I have a drawable-large-mdpi folder that holds 480x800 image, which I use in layout-large and it seems to fit well for screens 5.1", 5.4". From my understanding, layout-large is for screens ranging from 5.1" to 7.3". My question is how to provide a different image of dimension 1024x600 for 7" tablet? Which drawable folder holds this(1024x600) image that i can make use of for 7" tablets?
How could I store 480x800, 1024x600 images in the same folder with same name so that the former can be used on 5.1", 5.4" devices and the later for 7" tablets?
In Eclipse, AVD manager Device Definitions, 5.1", 5.4", 7" devices are specified as Large mdpi. Can i place 1024x600 image in drawable-large-mdpi folder that might scale down for 5.1" and 5.4" devices?
Please help me out. I'm pretty much confused about it.
for 7 inch tablerts you can use
drawable-large-mdpi
drawable-large-hdpi(for Nexus 7)

android screen supporting for different resolutions in same density

I'm developing an application which supports xhdpi devices.
so I created layout-xhdpi and drawable-xhdpi folders to place my drawables
and layouts.but I'm having a problem when supporting different resolution in same density.
as an example samsung galaxy nexus and sharp IS003 detects same layout-xhdpi folder because it has same density but when I run the application in both devices,it displays buttons and
images at different positions because both devices got different resolutions.
am I doing something wrong? should I create different folders for specific resolutions?
I have read supporting multiple screens documentation and tried to declare layouts like res/layout-sw600dp/ but it wont detect for IS03.
Please help me to solve this problem.
why you kept drawable-xhdpi?. there is no android tablet with xhdpi.
check here:
all the 10 inch tablet is only mdpi.
if you check your device density it will show only 160dpi for tablet.
there is xhdpi device for normal phone nexus S ICS.
so move all your drawable-xhdpi to drawable-mdpi and check it will work.

Categories

Resources