830 likes | 1.01k Views
Android Development for Different Screens and Devices. Rohit Ghatol. About Me. Rohit Ghatol Architect @QuickOffice Project Mgr @Synerzip Certified Scrum Master Author “ Beginning PhoneGap ” @Apress Founder TechNext Pune (Pune Developer Community). LinkedIn Profile. Topics.
E N D
Android Development for Different Screens and Devices Rohit Ghatol
About Me Rohit Ghatol • Architect @QuickOffice • Project Mgr @Synerzip • Certified Scrum Master • Author “Beginning PhoneGap” @Apress • Founder TechNext Pune (Pune Developer Community) LinkedIn Profile
Topics • Understanding UI Terms and Concepts • Building for Different Screen Sizes • Building for Different Tablets and Phone • Getting ready for Ice Cream Sandwich • Making your app run on all devices • Reference Material
Diversity on Android Android Devices • Handsets • Tablets • TV
Diversity on Android • Screen • Screen Size (2 inch to 50 inch) • DPI (120 – 320 ) • Optional Hardware (Telephony, Camera, GPS) • User Interaction • Touch, DPAD, Trackball, Keyboard
Screen Size Small Categories Medium Measured in Diagonal Large Extra Large
Screen Density DPI – Dots per inches Categories Low Normal High Extra High
Orientation Portrait Landscape
Density Independent Pixel (dp) 1 dp = 1.5 pixels 1 dp = 1 pixels 160 DPI Screen 240 DPI Screen
Range • xlarge screens are at least 960dp x 720dp • large screens are at least 640dp x 480dp • normal screens are at least 470dp x 320dp • small screens are at least 426dp x 320dp
Density Independence px dp
Screen Compatibility Mode For Android 3.2 and above
Screen Compatibility Mode Stretch to Fill Zoom to Fill For Android 3.2 and above
<supports-screens android:resizeable=["true"| "false"] android:smallScreens=["true" | "false"] android:normalScreens=["true" | "false"] android:largeScreens=["true" | "false"] android:xlargeScreens=["true" | "false"] android:anyDensity=["true" | "false"] android:requiresSmallestWidthDp="integer" android:compatibleWidthLimitDp="integer" android:largestWidthLimitDp="integer"/>
Compatibility Modes android:requiresSmallestWidthDp • Small Width Required for this application to be installed on the given device • Currently Android Market does not use it
Compatibility Modes android:compatibleWidthLimitDp • Small Width supported by the application. • If Smallest Side of Device > compatibleWidthLimitDp, user is offered to run application in Compatibility mode
Compatibility Modes android:largestWidthLimitDpSmall Width supported by the application. • If Smallest Side of Device > largestWidthLimitDp, application is forced run application in Compatibility mode (without any option)
UI Guidelines • Keep Business logic separate • Keep Views independent • Keep Navigation logic out of Views
< Android 3.1 • layout-small • layout-normal • layout-large • layout-xlarge
>= Android 3.2 • layout-sw600dp • layout-w720dp • layout-h500dp Now you can declare which layout to use at which width and not more vague partitions like layout-small, layout-normal, layout-large and layout-xlarge http://developer.android.com/guide/practices/screens_support.html#DeclaringTabletLayouts
Drawable-Resolution • drawable • drawble-nodpi – Not Scaled at all • drawable-ldpi ~ 120 dpi (.75x scale) • drawable-mdpi ~ 160 dpi (baseline scale) • drawable-hdpi ~ 240 dpi (1.5x scale) • drawable-xhdpi ~ 320 dpi (2x scale)
Icon GuideLines As of Android 3.0, Options menu has been superseded by Action bar For Android 3.0+
Menu Icons Guidelines For Android 2.3
Status Bar Icons For Android 3.0+
Status Bar Icons For Android 2.3
Available Resources drawable/ drawable-en/ drawable-fr-rCA/ drawable-en-port/ drawable-en-notouch-12key/ drawable-port-ldpi/ drawable-port-notouch-12key/
Device Configuration Locale = en-GB Screen orientation = port Screen pixel density = hdpi Touchscreen type = notouch Primary text input method = 12key
Step 1 Remove Contradictory Entry drawable/ drawable-en/ drawable-fr-rCA/ drawable-en-port/ drawable-en-notouch-12key/ drawable-port-ldpi/ drawable-port-notouch-12key/
Step 2-5 Start Filtering 2 Locale = en-GB Screen orientation = port Screen pixel density = hdpi Touchscreen type = notouch Primary text input method = 12key 8 11 12 14 # Config Precedence order
Step 2- 5 Filter by Language drawable/ drawable-en/ drawable-en-port/ drawable-en-notouch-12key/ drawable-port-ldpi/ drawable-port-notouch-12key/
Step 2-5 Filter by Orientation drawable/ drawable-en/ drawable-en-port/ drawable-en-notouch-12key/ drawable-port-ldpi/ drawable-port-notouch-12key/
HoneyComb UI New UI Elements • Fragments • Action Bar