Creating apps that work on all screen sizes

26,295 views

Published on

My presentation at droidcon. Please note , the slides by themselves are pretty mute , I would be pinning down some blogposts soon.

Also note on slide 8 the image on the top is incorrect [ and was on droidcon too :( ]

Creating apps that work on all screen sizes

  1. 1. Ravi Vyas
  2. 2. • Android Developer, Project Manager at Techjini Solution Pvt Ltd• Co-Organizer of the Bangalore Android User Group• Creator of the Blrdroid logos
  3. 3. • Screen size• Screen density• Orientation• Resolution
  4. 4. • Phones are not always• Android phones flavors : • Different screne sizes • Different screen densities• Always have a design plan for both portrait and landscape :• Landscape != Portrait + Δwidth - Δheight
  5. 5. • Use the <supports-screens> tag in the manifest to specify which screens you plan to support• <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true“ />
  6. 6. • You can provide different resources & layouts based on various factors like screen size , screen pixel density , orientation etc layout-land layout-port res-hdpi res-mdpi Android will handle changes by itself• Manually handle configuration changes onConfigurationChanged(Configuration newConfig) android:configChanges="keyboard|orientation"
  7. 7. • Do not use PX to specify size• Use rules for placement for pixel distances• Rethink, recheck your rules .• Check how alignParentLeft/Right will look on other screens
  8. 8. • 9 Patches
  9. 9. • XML Drawables <item android:id="@android:id/background"> <shape> <corners android:radius="15dip" /> <gradient android:startColor="#ff9d9e9d" android:centerColor="#ff5a5d5a" android:centerY="0.75" android:endColor="#ff747674" android:angle="270" /> </shape> </item>
  10. 10. • While designing the UI enter real sample data to better visualize the UI.• When displaying numbers , use the largest possible number to test• Don’t trust emulator.• Test on as many devices as possible.• Motodev Studio – Device Anywhere
  11. 11. • contact@ravivyas.co m• @ravivyas84• Ravivyas.com/+

×