Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Bust the Android Fragmentation Myth

23,741 views

Published on

Designers and developers have been afraid of the variety of Android flavors for way too long. Android borrows a lot of concept from the web, and we can use the same techniques to cater to the different OS versions and form factors.

Be responsive. Forget about absolute coordinates. Embrace the relative, use resource folders to differentiate among screen sizes, much like CSS media queries.

Be progressive. Take advantage of the latest Android functionalities, but gracefully fall back to the basics when you are on older OS versions. Remember the days when not all browsers have javascript?

Published in: Technology, News & Politics
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • You guys are great! We ended up buying a Grand Cherokee Limited like we wanted and saved over $6800...unbelievable!!! ✱✱✱ https://w.url.cn/s/Aaxmqpl
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Works For Teens! Hey, I'm only 18 and I thought I was going to have small boobs forever. After using your book for about 2 weeks, I started seeing results! I then used it for another month and I managed to get my breasts up to a C cup (with padding). I'm so pleased and I'm getting a lot more attention from boys now! Thanks you ✱✱✱ https://dwz1.cc/iZqgQnlK
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Get Result In Week One! Thank you, thank you, thank you! I've been plagued with small breasts for 30 years and even when I thought I couldn't do anything, your guide helped me to grow 1 cup size! I'm so pleased and I started seeing results in the first week. Thanks again Jenny, your work is amazing!! ✄✄✄ https://dwz1.cc/iZqgQnlK
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Bust the Android Fragmentation Myth

  1. 1. Bust the Android Fragmentation Myth Chiu-Ki Chan @chiuki
  2. 2. So many devices! @chiuki
  3. 3. Infinite screen sizes! @chiuki
  4. 4. Responsive + Progressive @chiuki
  5. 5. Hello World
  6. 6. @chiuki
  7. 7. @chiuki
  8. 8. @chiuki
  9. 9. @chiuki
  10. 10. @chiuki
  11. 11. @chiuki
  12. 12. @chiuki
  13. 13. Declarative Layout
  14. 14. @chiuki
  15. 15. @chiuki
  16. 16. (x,y) @chiuki
  17. 17. (x,y) @chiuki
  18. 18. Center @chiuki
  19. 19. Center <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/start" /> @chiuki
  20. 20. @chiuki
  21. 21. Proportional Layout <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:id="@+id/image1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:id="@+id/image2" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> </LinearLayout> @chiuki
  22. 22. @chiuki
  23. 23. Divider @chiuki
  24. 24. Divider <LinearLayout> <ImageView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@android:color/black" /> <ImageView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> </LinearLayout> @chiuki
  25. 25. Divider <LinearLayout> <ImageView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@android:color/black" /> <ImageView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> </LinearLayout> @chiuki
  26. 26. dp @chiuki
  27. 27. dp Density-independent pixel @chiuki
  28. 28. @chiuki
  29. 29. @chiuki
  30. 30. res/layout-land <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <ImageView android:id="@+id/image1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> <ImageView android:id="@+id/image2" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" /> </LinearLayout> @chiuki
  31. 31. @chiuki
  32. 32. Resource Folders
  33. 33. Resource Folders http://developer.android.com/guide/topics/resources/providing-resources.html Type Variation Language & Region: en, fr, fr-rCA layout Screen size: small, large, xlarge values Screen orientation: port, land drawable Screen density: ldpi, mdpi, hdpi, xhdpi, nodpi, tvdpi menu Platform version: v4, v11, v14 UI mode: car, desk, television, appliance @chiuki
  34. 34. Resource Folders http://developer.android.com/guide/topics/resources/providing-resources.html Type Variation Language & Region: en, fr, fr-rCA layout Screen size: small, large, xlarge values Screen orientation: port, land drawable Screen density: ldpi, mdpi, hdpi, xhdpi, nodpi, tvdpi menu Platform version: v4, v11, v14 UI mode: car, desk, television, appliance res/layout-land/activity_main.xml @chiuki
  35. 35. Resource Folders http://developer.android.com/guide/topics/resources/providing-resources.html Type Variation Language & Region: en, fr, fr-rCA layout Screen size: small, large, xlarge values Screen orientation: port, land drawable Screen density: ldpi, mdpi, hdpi, xhdpi, nodpi, tvdpi menu Platform version: v4, v11, v14 UI mode: car, desk, television, appliance res/drawable-hdpi/ic_launcher.png @chiuki
  36. 36. Resource Folders http://developer.android.com/guide/topics/resources/providing-resources.html Type Variation Language & Region: en, fr, fr-rCA layout Screen size: small, large, xlarge values Screen orientation: port, land drawable Screen density: ldpi, mdpi, hdpi, xhdpi, nodpi, tvdpi menu Platform version: v4, v11, v14 UI mode: car, desk, television, appliance res/drawable-large-land/splash.png @chiuki
  37. 37. res/drawable-large-land/splash.png @chiuki
  38. 38. res/drawable/splash.xml @chiuki
  39. 39. res/drawable/splash.xml @chiuki
  40. 40. XML drawable
  41. 41. XML shape <shape android:shape="rectangle" > <gradient android:startColor="#063" android:endColor="#030" android:angle="270" /> </shape> @chiuki
  42. 42. Gradient @chiuki
  43. 43. Gradient @chiuki
  44. 44. Pattern @chiuki
  45. 45. Tiles @chiuki
  46. 46. Tiles @chiuki
  47. 47. Tiling background <bitmap android:src="@drawable/tile" android:tileMode="repeat" android:dither="true" /> res/drawable/background.xml @chiuki
  48. 48. Tiling background <bitmap android:src="@drawable/tile" android:tileMode="repeat" android:dither="true" /> res/drawable/background.xml @chiuki tile.png
  49. 49. Tiling background <bitmap android:src="@drawable/tile" android:tileMode="repeat" android:dither="true" /> res/drawable/background.xml <View android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" /> res/layout/activity_main.xml @chiuki
  50. 50. Tile mode clamp Replicates the edge color repeat Repeats the bitmap in both direction mirror Repeats with alternating mirror images @chiuki
  51. 51. GridView @chiuki
  52. 52. Auto fit columns <GridView android:layout_width="match_parent" android:layout_height="match_parent" android:numColumns="auto_fit" android:columnWidth="@dimen/workbook_column_width" android:padding="@dimen/workbook_padding" android:horizontalSpacing="@dimen/workbook_spacing" android:verticalSpacing="@dimen/workbook_spacing" android:scrollbarStyle="outsideOverlay" /> @chiuki
  53. 53. Auto fit columns <GridView android:layout_width="match_parent" android:layout_height="match_parent" android:numColumns="auto_fit" android:columnWidth="@dimen/workbook_column_width" android:padding="@dimen/workbook_padding" android:horizontalSpacing="@dimen/workbook_spacing" android:verticalSpacing="@dimen/workbook_spacing" android:scrollbarStyle="outsideOverlay" /> @chiuki
  54. 54. Auto fit columns <GridView android:layout_width="match_parent" android:layout_height="match_parent" android:numColumns="auto_fit" android:columnWidth="@dimen/workbook_column_width" android:padding="@dimen/workbook_padding" android:horizontalSpacing="@dimen/workbook_spacing" android:verticalSpacing="@dimen/workbook_spacing" android:scrollbarStyle="outsideOverlay" /> @chiuki
  55. 55. dimen <resources> <dimen name="workbook_padding">8dp</dimen> <dimen name="workbook_spacing">12dp</dimen> <dimen name="workbook_column_width">120dp</dimen> <resources> res/values/dimens.xml <resources> <dimen name="workbook_padding">32dp</dimen> <dimen name="workbook_spacing">18dp</dimen> <dimen name="workbook_column_width">180dp</dimen> <resources> res/values-large/dimens.xml @chiuki
  56. 56. 7-inch @chiuki
  57. 57. Phone @chiuki
  58. 58. Progressive
  59. 59. Resource Folders http://developer.android.com/guide/topics/resources/providing-resources.html Type Variation Language & Region: en, fr, fr-rCA layout Screen size: small, large, xlarge values Screen orientation: port, land drawable Screen density: ldpi, mdpi, hdpi, xhdpi, nodpi, tvdpi menu Platform version: v4, v11, v14 UI mode: car, desk, television, appliance @chiuki
  60. 60. Resource Folders http://developer.android.com/guide/topics/resources/providing-resources.html Type Variation Language & Region: en, fr, fr-rCA layout Screen size: small, large, xlarge values Screen orientation: port, land drawable Screen density: ldpi, mdpi, hdpi, xhdpi, nodpi, tvdpi menu Platform version: v4, v11, v14 UI mode: car, desk, television, appliance @chiuki
  61. 61. Toggle button @chiuki
  62. 62. layout-v14 <ToggleButton android:layout_width="wrap_content" android:layout_height="wrap_content" /> res/layout/compound_button.xml <Switch android:layout_width="wrap_content" android:layout_height="wrap_content" /> res/layout-v14/compound_button.xml @chiuki
  63. 63. Include <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <include android:id="@+id/turbo" layout="@layout/compound_button" /> <include android:id="@+id/reset" layout="@layout/compound_button" /> </LinearLayout> @chiuki
  64. 64. Cast to superclass CompoundButton turbo = (CompoundButton) findViewById(R.id.turbo); if (!turbo.isChecked()) { // Slow down the computer } @chiuki
  65. 65. API level @chiuki
  66. 66. Detect API level android.os.Build.VERSION.SDK String, available from API level 1 android.os.Build.VERSION.SDK_INT int, available from API level 4 @chiuki
  67. 67. Progressive // Default value int heapSize = 16; // Detect OS version int sdk = Integer.parseInt(Build.VERSION.SDK); // Progressive enhancement for newer devices if (sdk >= Build.VERSION_CODES_ECLAIR) { // Static helper for API level 4 and below heapSize = HeapSizeGetter.getHeapSize(this); } @chiuki
  68. 68. Static helper public abstract class HeapSizeGetter { public static int getHeapSize(Context context) { ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); return activityManager.getMemoryClass(); } } @chiuki
  69. 69. Progressive // Default value int heapSize = 16; // Detect OS version int sdk = Integer.parseInt(Build.VERSION.SDK); // Progressive enhancement for newer devices if (sdk >= Build.VERSION_CODES_ECLAIR) { // Static helper for API level 4 and below heapSize = HeapSizeGetter.getHeapSize(this); } @chiuki
  70. 70. Support libraries Ship new functionality with your app! @chiuki
  71. 71. Official Support Library Fragment ViewPager SlidingPaneLayout DrawerLayout Loader LruCache TaskStackBuilder @chiuki
  72. 72. Community Support Libraries • • • • Action Bar Sherlock View Pager Indicator Nine Old Android Holo Everywhere @chiuki
  73. 73. View Pager Indicator @chiuki
  74. 74. Summary
  75. 75. Summary Responsive layout Declarative layout Density-independent pixels (dp) Resource folders XML drawables Progressive functionality Resource folders Version check Support libraries @chiuki
  76. 76. Thank you! Learn more http://pluralsight.com/courses/android-layout-fundamentals http://is.gd/FluidAndroidLayouts http://is.gd/BeautifulAndroid Stay in touch http://eepurl.com/lR5uD http://blog.sqisland.com http://twitter.com/chiuki @chiuki

×