0% found this document useful (0 votes)
212 views

Android Multiple Screen

The document discusses supporting multiple screens in Android user interfaces. It notes the growing number and variety of Android devices that have different screen sizes and densities. It recommends using resource qualifiers and density-independent units like dp and sp to develop interfaces that can adapt to different screens. The document also provides links to the Android developer documentation on testing interfaces using emulators and defining screen support in the manifest.

Uploaded by

Yap Wen Jiun
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
212 views

Android Multiple Screen

The document discusses supporting multiple screens in Android user interfaces. It notes the growing number and variety of Android devices that have different screen sizes and densities. It recommends using resource qualifiers and density-independent units like dp and sp to develop interfaces that can adapt to different screens. The document also provides links to the Android developer documentation on testing interfaces using emulators and defining screen support in the manifest.

Uploaded by

Yap Wen Jiun
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

MyGOSSCON2010

Android User Interfaces:


Supporting Multiple Screens
Yap Wen Jiun
@wenjiun
Multimedia University Lecturer
CodeAndroid Malaysia Member

   
Growing Number of Android Devices

Low-end
Phones Tablets

 
High-end
 
Phones
Generalized Density and Size

ldpi:low mdpi: medium hdpi: high

   
Some Statistics

http://developer.android.com/resources/dashboard/screens.html
   
Testing on Emulators

http://developer.android.com/guide/developing/tools/emulator.html
   
Screen Supports in Manifest

Within <manifest> element in AndroidManifest.xml

<supports-screens
android:smallScreens = "true"
android:normalScreens = "true"
android:largeScreens = "true"
android:anyDensity = "true" />

   
Using Resource Qualifiers

Size Aspect ratio Density


● small ● long ● ldpi
● normal ● notlong ● mdpi
● large ● hdpi
● nodpi
For example:
res/layout-small/main.xml
res/drawable-large-long-hdpi/android.png

http://developer.android.com/guide/topics/resources/providing-
resources.html
   
Using dp & sp to Define Size

Why using dp (density-independent pixel)?


● 100dp means 75px on QVGA at 120 density
● 100dp means 100px on HVGA at 160 density
● 100dp means 150px on WVGA at 240 density
Therefore, we will get rougly the same physical size.

Using sp (scale-independent pixel) for fonts


● sp is similar with dp but also scaled by the user's font
size preference

   
Draw 9-patch

   
References

Books
 Beginning Android 2
http://apress.com/book/view/9781430226291

Android Developers
 http://developer.android.com/

   
Thank you

Check out CodeAndroid Malaysia at


http://www.codeandroid.my/

● Small portions of this presentation are modifications based on work created


and shared by Google and used according to terms described in the Creative
Commons 3.0 Attribution License.

   

You might also like