Actually i am new in android. I want to create an simple app that is able to run in all devices. The screen resolution i have selected for running my app are.
QVGA (240 x 320)
HVGA (320 x 480)
WVGA(800) (480 x 800)
WXGA720 (720 x 1280)
WXGA(800) (1280 x 800)
Now i am not able to determine the name of the resources folder for all these different resolution. I have through the documentation i.e support multiple screen but i not able to create resources folder for WXGA720 (720 x 1280) and WXGA(800) (1280 x 800).
So please anyone suggest me what are the resources folder i have to create for all these resolution.
To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
For other cases in which you want to further customize your UI to differentiate between sizes such as 7” and 10” tablets, you can define additional smallest width layouts:
res/layout/main_activity.xml # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)
Remember to always define your layout meassurements in dp units. I have written a blog post to help you scale your layout xml-files proportionally so you only have to define them for a single "density bucket".
http://onemanmobile.blogspot.com/2012/04/how-to-scale-your-android-layouts-to.html
You usually create resource folders for the various density and size buckets, not for the specific resolutions. Normally applications only need a couple of different layouts (e.g: phone/tablet)
Related
Hello there fellow programmers!
Currently I'm having problem with deciding size of an image in Android. I've read about it in Screen Support Guide but I'm still confused about dpi and screen sizes. I have a 140x150 image in 72 dpi. If I resize it to 160 dpi (mdpi) it'll turn into a huge image. I focused on smartphones only but now I'm considering tab. Should I have made a 160 dpi image with the same size of 140 x 150, or having a huge 160dpi image is normal?
Update 7th Jan :
Found an interesting plugin in Photoshop called Cut & Slice, going to try it now.
A pixel is just a square.
A dpi (dot per inch) corresponds to the resolution of the image.
The more pixels per inch, the sharper an image will appear because of the size of each pixel.
The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160)
You should get two images with different size for different devices to improve the quality of your pictures and, when it's for webapps, the loading speed of your pages.
To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
The info I have found:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
But its coming from 2011. Now is 2014 and there are 2048x1536, 2560x1600, 1920x1200 tablets and phones. Are they still 720dp width or it does exist also 800dp, 1024dp or any other? That remains unclear to me because all the discussions I have found are from 2011 year, when there were no such devices on market.
If it depends on manufacturer, can you please share info about Sony Xperia tablet Z and Samsung TabPro 10.1 width in dp?
It also depends on density, not only on resolution.
Here are the equivalent for dp to pixels according to density :
mdpi : 1 dp = 1 pixel
hdpi : 1 dp = 1.5 pixel
xhdpi : 1 dp = 2 pixels
xxhdpi : 1 dp = 2.5 pixels
So, yes, a device with a resolution of 2560x1600 in xhdpi is 1530 dp wide.
I want my application components to look in a scaling mechanism. Means image size must look in proportion with screen size.
I know that to use 4 different drawable folders.
Considering hdpi as base (480 x 800) ratio would be:
mdpi 66.66%
hdpi 100%
xhdpi 133.33%
however xhdpi size accoring to above ration is 640 x 1060.
But samsung s3 screen size is 720 x 1280
So suppose If I have image of 100 x 100 in hdpi, and so 133 x 133 in xhdpi
But after applying above rule, Image in samsung s3 not looking proportionality with screen size as image size is based on xhdpi (133 x 133).
Same problem in hdpi with 480 x 854 screen size. Suppose I have to display images on screen, how to filled up that 54 px gap? as our images are based on 480 x 800 in hdpi folder .
So my question is how can we get smaller image for smaller screen size and bigger image for bigger screen size so that all layout and images looks in proportional with screen size?
If you do not compromise not even with a fewer pixels on the screen then it would be ideal for you to use
layout-sw720dp folder for Samsung S3
More info is provided in the official documentation
below are some typical screen widths to be used
res/layout/main_activity.xml # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)
and make your drawable folder like below
xhdpi: 720x1280
large-hdpi: 640x960
hdpi: 480x640
mdpi: 320x480
ldpi: 240x320
I have two 7 inch tablet one tablet (800*480) and second tablet (1024*600). I have facing problem following :-
1. Both can run on layout-mdpi and layout-large so how can i make different folder for run my app both resolution.
Application run xml for mdpi layout in both tablet:-
layout-mdpi
layout-hdpi
Application run xml for large layout in both tablet:-
layout-large
layout-xlarge
I can implement http://developer.android.com/guide/practices/screens_support.html this but not use full to me.
or
try so many link but still same problem both tablet running in same layout.
Try using this.It worked for me
layout-sw600dp
7" tablets—Android 3.2 introduces a new way to specify resources for more discrete screen sizes. The new technique is based on the amount of space your layout needs (such as 600dp of width), rather than trying to make your layout fit the generalized size groups (such as large or xlarge).
res/layout-sw600dp/
res/layout-sw600dp-land
res/layout-sw600dp-port
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800
hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
UI to differentiate between sizes such as 7” and 10” tablets
res/layout/main_activity.xml # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)
xlarge is a configuration qualifier for extra large screens.* When you append this string to a resource directory name (such as layout-xlarge), it indicates to the system that these resources are to be used on devices that have an extra large screen.
I have two 7 inch tablet one tablet (800*480) and second tablet
(1024*600). I have facing problem following :-
I have faced the Same issue. as a workaround i have make the xml file for (800*480) in same layout folder as Default.
Also used layout-sw320dp for the Devices like GalaxyNexus
and for 7'' Tablet i have make layout-sw600dp for 7'' Screen Tablet
and for 10'' Tablet i have make layout-sw700dp for 10'' Screen Tablet
For Example : you have the xml file named "activity_main.xml"
1) inside layout folder--> put activity_main.xml with layout according
to nexus one(480*800 hdpi)
2) inside layout-sw320dp folder--> put activity_main_tab.xml with
Layout according to Galaxy Nexus(720*1280 xhdpi) Device which
should take the layout from layout-600dp but will take layout from
layout-320dp
3) inside layout-600dp folder--> put activity_main_tab.xml with layout according
to tablet 7'' Screen
4) inside layout-700dp folder--> put activity_main_tab.xml with layout according
to tablet 10'' Screen
after making the Layout formated as above. i have checked runtime width and height of device. and set the layout file accordingly.
if (displayWidth >= 552 && displayHeight >= 976 || displayWidth >= 976
&& displayHeight >= 552) {
Log.i(TAG, "in tab xml");
setContentView(R.layout.activity_main_tab);
}else{
Log.i(TAG, "in Simple xml");
setContentView(R.layout.activity_main);
}
Hope this will Help.
I am creating an app for both a 10-inch and a 7-inch tablet.
My problem is, on the 10 inch tablet it's not working well. On the 7-inch one it is. I copied small images in the hdpi folder and big images in the xhdpi folder. I tried using below way but I am getting a problem on 10-inch tablets. Here images looking small like that. I thought the 10 inch tablet was also taking hdpi folder images. The app is in landscape mode.
How to make this app for both tablets?
XML files:
res/layout-large/main.xml -----7 inch
res/layout-xlarge/main.xml -----10 inch
Images:
res/drawable/hdpi---7 inch images
res/drawable/xhdpi---10 inch images
Table dimensions 7 inch:
1024 to 600
density 240
ramsize 512
version 3.0
Table dimentions 10 inch:
1280 to 800
density 160
ramsize 512
version 3.0
You've got to use the new qualifiers at the bottom of http://developer.android.com/guide/practices/screens_support.html
For example
res/layout/main_activity.xml # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)
HDPI is for density ~= 240
XHDPI is for density ~= 300
Your 10 inch tablet is density 160, which is MDPI.
Also LARGE & XLARGE depends on the screen size (resolution), but your drawable folders depend on the screen density, which is not the same thing.
Here are all the infos you need : http://developer.android.com/guide/practices/screens_support.html