Using appropriate layout markup according to screen resolution - android

I've got a design list for 480x800, 1024x600, 1280x800. How do I ask android to use exact markup based on user screen's resolution ?
As far as I know there're only abstract means(hdpi,xdpi) for solving resolution difference.

How do I ask android to use exact markup based on user screen's resolution ?
Talented developers don't do that. Talented developers realize that only a percentage of Android devices run at the resolutions listed above, just as desktop Web browsers do not run at only three window sizes. Talented developers work with the graphics designer to come up with fluid layouts for different screen sizes (e.g., -normal, -large, -xlarge), which may or may not run at the aforementioned resolutions. For example, there are devices with screen sizes ranging from 4" to 7" that run at 800x480, and there are devices with screen sizes from 4.5" to 10.1" running at 1280x800 (or thereabouts).
As far as I know there're only abstract means(hdpi,xdpi) for solving resolution difference.
-hdpi and -xhdpi have nothing to do with screen resolution. They are for screen density. Density is independent of resolution, and density is largely independent of size.

Create folder based screen width or height. For example
res/layout-w480dp, res/layout-w1024dp, res/layout-w1280dp
Or
res/layout-h800dp, res/layout-h600dp
Read more here, Table 2. Configuration qualifier names.

Afaik, you can markup the layout folder by that is the minimum required screen resolution for the layout you can set one to min600 and one to min 800.
I think this markup scheme is supported in honeycomb and above and since these are tablets resolutions, they will have either anyway.
see this and this

Related

How to handle layout screens for all android device sizes

I have got an enhancement of one application. It is developed for 10.1 inch tablet. However it is working nice for tabs with size 10.1’ and for other screen sizes UI is poorly aligned. I need to do the changes in application so that it will be as good as 10.1 inch app for all other screen sizes(>4 inches).
I have few doubts here on my approaches.
1) I have found “size qualifiers” in android developer’s site. How many type of layouts need to use for each screen to make good for all sizes in android world.
Note: All screens in this application are always on land scape orientation. Is size qualifiers still works here?
2) Somewhere I found in “stack overflow “, It is already developed for 10.1 inches so that use percentages and change to every screen size.
100% -> 10.1’
? -> 7’
Which one is good and proper solution for maintenance also? Is there any other best solutions?
There is no hard and fast answer.
It is up to you to determine how many screen sizes you want to optimize for.
I'd suggest optimising for small, mid and large with layout qualifiers:
1) size qualifiers do work in landscape as they assess based on smallest screen width.
layout
layout-sw600dp
layout-sw800dp
2) I dont understand your question... i've never seen percentages used in Android layouts
There are so many different screen sizes that you can adapt your layout to..
In Eclipse's graphical layout you can also choose the screen size and resolution for which you want to develop (you can define the screen sizes and resolution and you will see how the layout looks on each of them).
You can also have several images that will be chosen automatically for each screen size via the drawable folder. You got drawable-hdpi for high density screens, drawable-xhdpi for extra high density screens and so on.. you can change an image to adapt to many of the screen size using Google's Android Asset Studio : http://romannurik.github.io/AndroidAssetStudio/index.html
You should also read the Android developers guide:
http://developer.android.com/training/multiscreen/screensizes.html
http://developer.android.com/guide/practices/screens_support.html

Drawable-mpdi on Xoom and HTC mobile

I am developing app for Mobiles(HTC) and Motorola Xoom. But the problem i am facing is that both Uses Drawable-mpdi bitmaps.
abd there is difference in screen size of both, The Image which is perfect on Mobile is became very small on Tablet.
I have checked the list for Drawable folders used by devices.
Please Help me how to sort out this Problem ?
How can I make different size images for both of devices.
Thanks
I can think of a couple of ways to do this. Hopefully, other people will add more.
You could use the MDPI folder with a single image of high enough resolution for the tablet then let Android scale it for smaller devices using the scale properties of an ImageView. However, you are focusing only on HTC and Xoom and that doesn't solve your problem for devices which use other generic resolutions.
Or, you could use the drawable-nodpi folder and have several images with your own resolution naming scheme e.g. myimagesmall.bmp, myimagemedium.bmp etc. Then at runtime, measure the device screen size and DPI and load the appropriate image.
Or, combine them. Use nodpi and a single image and let Android scale for you. Using BitmapFactory, you can control dithering and anti-aliasing to get good results.
Good luck!
Speaking about density, Motorola XOOM also uses mdpi drawables, so to differenciate drawables between tablets and small phones you should use folders with respect to screen sizes. Phone screen size is usually treated as normal, and a 10-inch tablet is xlarge, so drawable-xlarge-mdpi is the folder name you should use to place drawables for 10-inch tablets. Hope this helps.
From the http://developer.android.com/guide/practices/screens_support.html
The configuration qualifiers you can use to provide size-specific resources are small, normal, large, and xlarge. For example, layouts for an extra large screen should go in layout-xlarge/.
Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you should instead use the swdp configuration qualifier to define the smallest available width required by your layout resources. For example, if your multi-pane tablet layout requires at least 600dp of screen width, you should place it in layout-sw600dp/. Using the new techniques for declaring layout resources is discussed further in the section about

Supporting all Android tablets resolutions

The designer of our company wants me to give him the resolutions of Android tablets so he will start designing a new app.
I know there are a lot of different resolutions (listed here: Android Tablets computers).
I also know about the division of Android to the different dpi's (ldpi, mdpi, ...).
My questions :
What should I tell the designer? He obviously not supposed to make a version for each resolution. Besides, some of the resolutions listed in the link above are in the same dpi, so which one should I choose?
Considering the fact the app is going to run only on tablets, what are the dpi classes I should use? Only hdpi and xhdpi? Or should I still use all 4 classes and limit the <supports-screens> tag in the manifest?
Is there a resolution that represent each of the dpi classes that I
should stick to?
I've done some reading about 9-patch. What's the point of using it if I still need to deliver a version for each dpi??
Thanks in advance!
The questions contain so much information.
1 Try to read the article and the references in it.
http://www.androiduipatterns.com/2011/11/design-patterns-for-responsive-android.html
You could also have a look at the web site for android design.
http://developer.android.com/design/index.html
In one word, designing for android tablets is more like designing websites. You cannot just design for one resolution.
2 Considering you are developing for tablets, it's necessary to support mdpi and hdpi. If the apps could be installed on phones, maybe xhdpi is also needed. It's not very strict.
3 dpi(dots per inch) = pixels per inch. So dpi is like density, it do not have strict relationship with resolution. But there is still a sheet could help you, try to find it in the following page
http://developer.android.com/guide/practices/screens_support.html
4 9-patch resource is very useful. With which a small png could stretch to any size without distortion. And it could also help to reduce the size of your resources.
In most situation, you do not have to make 9-patch for each dpi, since it could stretch to any size you want. But if the 9-patch png contain some information itself, like min height and padding, it's necessary to make different versions.
Here is what I would do:
See what combinations you have. There are mostly 3 resolutions for tablets (1280x800, 1024x600, 800x480) and mostly 2 densities (hdpi and mdpi). That is at most 6 versions. Select a few matching your most logical targets (I would choose xlarge mdpi (9" 1280x800), large mdpi (7" 1024x600) and normal-hdpi (4-5" 800x480) and design on these.
Some graphical elements don't need to be designed for each combinations, like backgrounds, may be buttons… Here comes the 9-patch. To be put in drawable-nodpi folder. One resource fits all.
Do one version first on you major target, then see how it fits on the other targets, and consider adjustments from there.
Use ScrollViews if you don't want to position every item pixel-perfectly on each device.

What is the best screen resolution for an Android AVD?

This is might seem to be a sort of silly question to ask but I would like to know while testing our apps what is the best resolution to be used (HVGA/WVGA/QVGA?etc)?
I ask this because I want the layout and the performance of the device to be consistent across most screen sizes.
There is a regularly updated diagram with the screen sizes and densitys available at the android developers site:
Source
This doesn't tell you an exact resolution, but seperates all phones into 4 sizes (small, normal, large, xlarge) and densities. This should give you a hint at least.
The biggest chunk is obviously Normal/hdpi, I guess that should be a lot of 3.7" HDPI displays with a 480x800 resolution (or at least close to this res). Like the Nexus One or HTC Desire (there are sure some newer ones, but I only keep an eye on the market when I'm searching for a phone to buy).
You can use all resolution to test your application, because some phones have QVGA resolution, some HVGA or WVGA resolution. Tablets have others resolutions.
More informations : http://developer.android.com/guide/practices/screens_support.html
If you use the dp unit for the sizes of your screen elements, then you shouldn't need to worry (as much) as this is a relative size, based on the pixel density of the screen.

How big is an android phone's screen?

How big is the smallest motorola android's screen, in pixels? I want to know what size I need to make my graphic without it being too distorted by the fill_parent.
Although this doesn't directly answer your question..
Android is the name of the operating system running on Android phones. Different phone models could have different resolutions and pixel densities. Therefore you have to be careful not to hardcode resolution values into your code. It might run well on one phone but poorly on another.
Check out these pages for details about supporting different screens:
http://developer.android.com/guide/practices/screens_support.html
http://developer.android.com/resources/dashboard/screens.html
It would be unwise to program for one screen size, especially if you plan on distributing your application later. You should design your application for as many screen sizes as possible.
Instead use nine-patch images and flexible layouts.
If you are designing an icon, the look at the android icon design guidelines and consider high, medium and low density screens. There are different resource folders for these too and android takes care of selecting the appropriate one for the current device.
motorola droid's display size is 480x854 px, according to specs, so it's rather non-standard

Categories

Resources