6

I'm new to Android programming. I've seen different phones with different screen resolutions that run on Android. How can I create an application that works on all android devices with out any distortion in my application views.....

Satyam
  • 15,493
  • 31
  • 131
  • 244

3 Answers3

6

The short answer is to size all your layout items in dip. dip is short for Density-independent pixel and Android automatically scales items sized in dip to be the same size on different screens. (You can shorten dip to dp in your layout XML files.)

The long answer is to read this article on the Android developer website. It is long but I highly recommended reading it from beginning to end at least once before you get too far with you application.

David Webb
  • 190,537
  • 57
  • 313
  • 299
2

There are several ways to achieve Screen Independence..

  • Use 9 patch images wherever possible
  • Design Layout using dimension units as dp, sp and measurements(in, mm...etc).
  • Use fill_parent and wrap_content wherever possible.
  • Use resource along with qualifiers (Specifying resources for a group/type of device)
  • Designing, scaling and fitting using custom coding for your program (Not recommended) Do read the following:

http://developer.android.com/guide/practices/screens_support.html (Take good look at testing, best practices more keenly)

1

There are some best practices to have resolution independent app,

  1. To use all 9 patch images.
  2. To create layout according to Density Independent Pixel.
Rajnikant
  • 1,097
  • 1
  • 7
  • 22