Android UI Design: Supporting Multiple Screens

Creating Same UI Supporting Different Screen Sizes?

Use SDP - a scalable size unit library for supporting different screens.

An android SDK that provides a new size unit - sdp (scalable dp). This size unit scales with the screen size. It can help Android developers with supporting multiple screens.
Here is the LINK

UI design for Multiple Screen sizes

  <compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="large" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="xlarge" android:screenDensity="xhdpi" />

<!-- support for Xperia Z, Galaxy S4 and HTC One -->
<screen android:screenDensity="480" android:screenSize="normal" />
<screen android:screenDensity="480" android:screenSize="large" />
</compatible-screens>

Try this code in the manifest I think this will work..
Other wise Create separate folders in res folder like layout-small, layout-large, layout-normal, and use appropriate images in the drawable folder drawable-hdpi, drawable-ldpi, drawable-mdpi... I am sure this will help you for various screen orientation..

Supporting multiple screen size - Android

I just did something very similar. To stretch the app without creating new layouts I used dimensions set in XML

res/values/dimensions.xml
res/values-sw600dp/dimensions.xml -> 7+ inches
res/values-sw720dp/dimensions.xml -> 10+ inches

Dimensions are resources files:

<dimen name="default_padding">11dp</dimen>

You can increase the dimensions by about 30% in the 600 and 720 file.
Then simply used @dimen/default_padding in your layout and it will be scaled

Regarding images, either you make sure you have all your assets in all densities, or you set fixed size to you ImageView's and appropriate scaleType

layout for multiple screens

Your question is a complex one, but the short answer is that Android has different screen types and sizes, and therefore the determining factor on which resource gets used are:

  • Localization
  • Pixel Density of your device

Android looks at your Pixel density and determines which resource to use (if you specified any resources for large or small devices). But for this to work, you need to follow the localization and resource qualifier precedence. An example below:

Which Resource Takes Precedence?

I recommend you take a look at Localization , Alternative Resource and Different Screen Densities. If your folder qualifiers are not setup correctly, Android will ignore these resources and use the default one. Your resource folder should look something like this:

res/
drawable <- default
drawable-ldpi <- Alternative resources for low to large pixel densities
drawable-mdpi
drawable-hdpi
drawable-xhdpi
drawable-xxhdpi
drawable-xxxhdpi
values-sw600dp/
values-fr/ <- Values for french resources
layout/ <- Layout default
layout-land/ <- Alternative layout for landscape orientation

You can also Google these if the Android Developer Guide is too vague for you. I hope this helps

Android and supporting multiple screens layouts

I think you're on the road to hell.

Android runs on an enormous variety of devices, more every week, and many formats don't exist yet but will introduce new variables. So even if you succeed, one new device with a slightly different screen size, and your app will fail.

It's a mistake to design for Android using specific screen resolutions, and is similar to the issues you'd find if you forced all pages to be the exact same size on the web, it rarely works well (e.g. even a tidy fixed-width site will fail miserably on mobile devices).

Android has been designed to support all this variation, but if you try to get pixel-perfect absolute-positioned rendering on every screen size you are swimming against the tide. It is likely to be very painful, very time consuming and expensive, and likely to ultimately fail. Even if you succeed, how on earth will you test it on all these screen variants? It sounds like testing hell too.

I STRONGLY recommend you accept you cannot do everything as exactly as you need to, and instead look at how to use ways of rendering objects fluidly, relative to each other, so the app looks good in all the different variations, using the different layouts for each group of resolutions to improve the experience on different size screens.

How to design app for multiple screens

Always use dp while designing android layout.
Have a look on following url for better understanding of multiple screen support in android. http://www.survivingwithandroid.com/2012/07/how-to-support-multiple-screen-in.html

Android multiple screen design

In my experience you don't really need to customize your layout for the small/medium/large/etc screens, as long as you have your drawables for the different densities. Like the documentation says, Android will attempt to render your layout properly on different screen sizes.

By default, Android resizes your application layout to fit the current device screen. In most cases, this works fine. In other cases, your UI might not look as good and might need adjustments for different screen sizes.

The 'other cases' applies only if you really want to change your layout on larger screens.

Using android:scaleType="center" works for me, but it will, like you said, leave empty space around your layout on larger screens if it should fit on smaller screens as well. If you have a fully customized view with 'widgets' that should be placed exactly right, and you don't want to be programmatically determining the scaling and applying the same scaling to your widgets, this is definitely the way to go.



Related Topics



Leave a reply



Submit