4

I have been doing a lot of research on the best ways to design layouts for different screen sizes, screen density and orientations and I am getting increasingly confused.

1. Design Density vs Screen Size
I have read this link

Now when designing for gingerbread what should be considered. Layouts in each folder say LDPI, HDPI and MDPI. But that increases the size of the entire application.

Now i have stopped considering for LDPI. But now we also have XHDPI and XXHDPI. So how do we go about designing for all pages and yet keep the size reasonable?

And what should be given more preference screen size, density or resolution?

FOr images 9-patch images can be used . What is the best tool to create them?

2.Landscape vs Potrait.

Now in this layout equation if we include different layouts for screen orientation, the application becomes bulkier and the work tedious.

Creating smaller xmls and including them is one good solution but even then ,considering all the different types it still becomes tedious. Specially for Android 4 and above with each fragment having a different layout,

My question is-- what is the best and most efficient way to design layouts considering all the above.

Community
  • 1
  • 1
D-D
  • 954
  • 2
  • 12
  • 27

3 Answers3

6

You can try folling links: Question seems to be broad. but you can read this.

  1. Welcome to Android Design,

  2. Is there a standard layout for an Android app or should I design mine from first principles?,

  3. 10 Tips For Android UI Design,

for 9-patch images you can see this post by me.

  1. Utility of android nine patch

  2. Education Guidelines

For supporting multipal device layout based,

please go through Supporting Multiple Screens this link:

For multpal layout component

res/layout/my_layout.xml             // normal screen size ("default")
res/layout-small/my_layout.xml       // small screen size
res/layout-large/my_layout.xml       // large screen size
res/layout-xlarge/my_layout.xml      // Hd tablet

for orientation.

        res/layout/              # default (portrait)
            main.xml
        res/layout-land/         # landscape
            main.xml
        res/layout-large/        # large (portrait)
            main.xml
        res/layout-large-land/   # large landscape
            main.xml


1. You can also use `qualifier` for having multipal resource. 
Community
  • 1
  • 1
Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85
2

One thing that you can do is create different folders for each type of screen size / resolution such as

values- - ldpi - mdpi - hdpi - xhdpi - nodpi - tvdpi

And them inside values you can have folders such as dimens, integers, booleans, etc..

Them inside your XML layouts you use something such as android:width="@integer/size_for_this"

Android will know which folder to reference based on the device DPI. You can also specify other type of folders such as by Width, height, etc...

More info in the Official documentation Providing Resources

Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85
Marcus Gabilheri
  • 1,259
  • 1
  • 14
  • 26
  • Is this possible for gingerbread too? – D-D Jun 04 '14 at 06:06
  • resources folders based on screen size was added in API lvl 4 and for density was added in API lvl 8. SO yes, it is possible to use it in Gingerbread. The official link that I provided for the Android Documentation has detailed explanation of what was added in each API. – Marcus Gabilheri Jun 04 '14 at 06:10
2

The Play Store allows you to publish multiple APKs' targeting devices with different hardware. The device property that you are targeting is specified in the manifest of each different APK. For different screen densities, you use the <compatible-screens> element. For instance, an application targeting small-sized devices with ldpi resolution would include:

<compatible-screens>

    <screen android:screenSize="small" android:screenDensity="ldpi" />

</compatible-screens>

In this way, you compile & build different APKs' for the same application targeting different devices, and you include different-sized images in your res/drawable directory depending on the device resolution that each individual APK is aimed at. The different APKs' can be published on the Play Store under the same application heading and will be automatically filtered by the Play Store Services APK (i.e. the Play Store app present on every Android device) based on that device's hardware.

References:

1. Multiple APK Support.

2. Distributing to Specific Screens.

3. Filters on Google Play.

Yash Sampat
  • 30,051
  • 12
  • 94
  • 120