Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Multiscreen Support in android : 540x960 issue

My application is supporting 3 type of density ldpi (120),mdpi(160),hdpi(320) and for that we have three folder for resources (ldpi,mdpi,hdpi).

But my problem is occurring in HTC sensation XE (540x960) having density ~256 dpi.and my resources is stretched.

In manifest file

<supports-screens android:xlargeScreens="false" /> 

means i am not supporting for xlarge screen so does 540x960 come in high density??. How can i overcome this problem???

Android Multiscreen Support issue says "You can also use a combination of density and size qualifiers but that still leaves some room for two different resolutions falling into the same bucket."

What should be the name of drawble folder for this kind of resolution?? or is there any other way to short out this issue.

EDIT : My problem is not with layout, my problem 540x960 come in HDPI but my hdpi drawbles are designed related to 480x800

Help me..

Thanks in advance..

like image 727
Bhavesh Hirpara Avatar asked Jan 17 '23 18:01

Bhavesh Hirpara


2 Answers

you can use below combination for Layout for HTC sensation XE (540x960) :

res/layout-w540dp-h960dp/layout.xml 

this will use for pick layout for this device and for drawable it will pick image from hdpi because in this developer site 256 dp come in range of hdpi . http://developer.android.com/guide/practices/screens_support.html.

hope this will help you.

like image 82
Herry Avatar answered Jan 20 '23 03:01

Herry


Your problem is that you have designed your bitmaps for a particular screen size rather than screen density.

Plainly put, you should not do that. There are a huge number of different form factors and screen sizes out there, and you cannot hope to have graphics sized for all of them. So you fix this issue for 540x960 screens... what then with your users who are on 480x854 displays (most hdpi motorola devices)? Will you include different graphics for 1024x720 and 1280x720 displays if you're developing for that? What about 1280x800?

Granted - it can be a pain to deal with these issues, but that is the price we pay for diversity of devices. And Google has provided a fair amount of powerful tools at our disposal to deal with this.

When you are designing an app for Android, you need to think of the design as if you were designing a website - not a desktop (or IOS) program. All (or most) of the tricks that you use for designing a website also apply here - plus you have the density-awareness and 9.patch tools.

And if you really cannot adjust your graphics/layout to the screen without messing it up, you can always center the layout on the display (or align it left or right, depending on what you think looks best).


Edit:

As I mention above, the core to flexible UI design in Android is to think of your app like a web site. Roman Nurik has an article discussing this on the Android blog.

http://android-developers.blogspot.com/2011/09/thinking-like-web-designer.html

Apart from that, it is mostly covered by the Android site, etc.

http://developer.android.com/training/multiscreen/index.html

Using the right layouts and 9-patch images (not always - sometimes static images are better) will allow you to create designs that look good on all phones. But you have to realize that - like a website designed in a browser - you do not and can not have 100% control over how things are displayed on every single device. What you need to achieve is that it is still accessible and good-looking even when displayed on a device that you did not anticipate beforehand.

like image 39
Michael A. Avatar answered Jan 20 '23 03:01

Michael A.