Multiscreen Development in Android

Manikantan K
Manikantan.k@samsung.com
@manikantan_k
Introducing DP
DP = Density Independent pixels
Also called DIP
•Introduced to declare and create UIs that are screen
size/resolution independent.
•Helps to ensure interfaces work well across devices of
different aspect ratio/ screen density etc.
•In Android, refrain from using px for width/distance and
other measurements. Always use DP.
Concept of DPs
resolution = number of pixels available in the display
density = how many pixels appear within a constant area
of the display, dots per inch = dpi
size = amount of physical space available for displaying
an interface, screen's diagonal, inch
density-independent pixel = virtual pixel that is
independent of the screen density, dp
Concept of DPs
Without device independence

With device independence
Concept of DPs
Density or dpi = Physical Size / Resolution
Baseline density in Android = 160
DIP or DP = Resolution / ( density / 160 )
A little about Density
Galaxy Nexus
4.65”

800x1280

316 dpi

1.
2.

7”

720x1280

Notes

Nexus 7

216 dpi

Higher density/ dpi = more data, more clarity.
Two devices with same/similar resolution need not have same
physical size and vice versa.
Screen sizes & Density buckets

*Only a guideline
Designing for phones and tablets
Handling different sizes
Explicitly declare in the manifest which screen sizes
your application supports
Handling different sizes
Provide different layouts for different screen sizes
Handling different sizes
Provide different bitmap drawables for different screen
densities
Handling different sizes
Use qualifiers effectively

<resources_name>-<qualifier>
Handling different sizes
Some recommendations from Google
Tip Preview all screens via IDE
Handling different sizes
Using 9-patch images helps you scale a graphic without
distortion.
Use 9 patch images for BG of Buttons, EditText etc

9-patch tool comes as a part of the Android SDK
Some resources
http://developer.android.com/guide/practices/screens_support.html
http://developer.android.com/design/index.html

http://blog.edwinevans.me/?p=131
http://blogs.captechconsulting.com/blog/steven-byle/understandingdensity-independence-android
http://stefan222devel.blogspot.com/2012/10/android-screen-densitiessizes.html
http://developer.android.com/tools/help/draw9patch.html

Developing and Designing Multiscreen Android apps