How to differentiate layout for 480 * 800 and 480 * 854 screen resolutions in android?

Both the resolutions are considered under the layout-long, so you have to set the layout as per the device's height and width manually As per my view this is the best solution . I applied the same solution for my application Example DisplayMetrics dm = new DisplayMetrics(); getWindowManager(). GetDefaultDisplay().

GetMetrics(dm); height = dm. HeightPixels; width = dm. WidthPixels; if (height == 854 || width == 480) { // Your view } else { // Your VIew } You have to check the above condition in onCreate() method of acivity.

Both the resolutions are considered under the layout-long, so you have to set the layout as per the device's height and width manually. As per my view this is the best solution . I applied the same solution for my application .

Example DisplayMetrics dm = new DisplayMetrics(); getWindowManager(). GetDefaultDisplay(). GetMetrics(dm); height = dm.

HeightPixels; width = dm. WidthPixels; if (height == 854 || width == 480) { // Your view } else { // Your VIew } You have to check the above condition in onCreate() method of acivity..

It should be possible to differ between WVGA854 and WVGA800 by using: res/drawable-hdpi-long/ res/drawable-hdpi-notlong/ but I would definately recommend you to design the layouts so that it is robust enough to use one set of layouts for those two screens. It will be too much work to maintain/test of you can't design one layout in that case.

Thanks for replying. But what you said is suitable for images. Can we also do the same with layouts such as layout-large-long and layout-large-notlong.

– sunil Mar 31 at 12:50 sorry, you can do the same, i.e. Res/layout-hdpi-long, and res/layout-hdpi-notlong – softcharles Mar 31 at 12:56 If I create those folders inside res it gives me compile time error. Have you used this way in any of your application?

– sunil Mar 31 at 13:32 ah sorry, it should be res/layout-long-hdpi and res/layout-notlong-hdpi. Chirag is probably right, i.e. Both layouts are considered long.

Check this stackoverflow. Com/questions/1893838/… – softcharles Mar 310 at 6:02.

You can explicitly define your layout width and height in layout xmls to be 800*480 for all the un-supported resolutions like 1024x600. I don't recommend fix your width and height to a specific value but since it's client request, I guess you have to take it. Or you could set target sdk version to 1.5 or 1.6. I haven't really tried it yet, but I read somewhere that doing so limits the application to be displayed in a lower resolution.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions