SlideShare a Scribd company logo
Android
Fragment-Awesome
Matthew Gaunt
Who is this guy?
• Master in Computer Science in Bristol
• Senior Android Dev @ Mubaloo
• Cross Platform Dev @ Future Platforms
What Fragmentation?
What’s coming up
• Design - I can haz pretty
• Dips
• Buckets?
• What buckets?
• The story of buckets
• Tips + Examples
Dips
Density Independent Pixels
Abstract the screen size (think rounded
corner rectangle)
Never assume dip > pixels
Buckets?
ldpi mdpi hdpi xhdpi
What Buckets?
Screen density (ldpi, mdpi, hdpi, xhdpi)
Orientation (port, land)
AndroidVersion (v4, v11)
Screen size (small, normal, large, xlarge)
Eeks lots of Images
How to use Buckets
• Images - [ldpi, mdpi, hdpi, xhdpi] [small, normal, large, xlarge]
• Layout - [land, port]
• Themes / Styles - [v4, v11]
• Dimensions - [small, normal, large, xlarge]
The History...
The History...
<port>
land
1.5
The History...
<port>
land
1.5 1.6
ldpi
mdpi
hdpi
The History...
<port>
land
1.5 1.6
ldpi
mdpi
hdpi
3.0 (ish)
small
normal
large
xlarge
The History...
<port>
land
1.5 1.6
ldpi
mdpi
hdpi
3.0 (ish)
small
normal
large
xlarge
4.0
ldpi
mdpi
hdpi
xhdpi
Recap
• Lots of buckets
• Lots of resources to apply the buckets to
• How it relates to other platforms like iOS
Random.
Phones / Tablets?
ldpi mdpi hdpi xhdpi total
Small
Normal
Large
XLarge
1.7% 2.4% 4.1%
0.7% 18.5% 66.3% 2.5% 88.0%
0.2% 2.8% 3.0%
4.9% 4.9%
ldpi
mdpi
hdpi
xhdpi
Phones
normal / small
mdpi
? hdpi ?
? xhdpi ?
Tablets
large / xlarge
Hitting Both?
drawable
drawable-ldpi
drawable-mdpi
drawable-hdpi
drawable-xhdpi
drawable-large-?
drawable-xlarge-?
For all buckets
Base
Additional
Tips to Reduce Work
1
Use values everywhere
(dimens, ints, etc.)
Tips to Reduce Work
values
dimens.xml
<resources>
        <dimen name="default_text_size">20sp</dimen>
        <dimen name="default_large_text_size">30sp</dimen>
        <dimen name="splash_vertical_spacing">20dp</dimen>
        <dimen name="gauntface_tag_bottom_spacing">20dp</dimen>
        <dimen name="gauntface_tag_padding">5dp</dimen>
        <dimen name="gauntface_tag_radius">10dp</dimen>
        <dimen name="splash_gauntface_progress_bar">30dp</dimen>
        <dimen name="generic_dialog_padding">15dp</dimen>
        <dimen name="generic_dialog_bg_radius">4dp</dimen>
        <dimen name="generic_dialog_title_spacer_height">4dp</dimen>
        <dimen name="generic_dialog_title_spacer_vertical_spacing">10dp</dimen>
        <dimen name="sync_info_padding">10dp</dimen>
        <dimen name="sync_info_title_text_size">35sp</dimen>
        <dimen name="sync_info_msg_text_size">20sp</dimen>
        <dimen name="sync_info_bg_radius">10dp</dimen>
        <dimen name="sync_info_prof_pic_radius">8dp</dimen>
        <dimen name="sync_info_prof_pic_size">128dp</dimen>
    </resources>
values-land
dimens.xml
<resources>
        <dimen name="default_text_size">15sp</dimen>
        <dimen name="default_large_text_size">25sp</dimen>
        <dimen name="splash_vertical_spacing">10dp</dimen>
    </resources>
Tips to Reduce Work
values values-land
Tips to Reduce Work
2
Learn the ways of the
nine patch
Tips to Reduce Work
Tips to Reduce Work
3
Use <Shape> drawables
Tips to Reduce Work
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:angle="0"
        android:endColor="@color/dark_blue"
        android:gradientRadius="660"
        android:startColor="@color/splash_light_blue"
        android:type="radial" />
</shape>
Tips to Reduce Work
Tips to Reduce Work
4
Use Themes & Styles
www.gauntface.co.uk/blog/2011/01/18/android-ui-reference
Tips to Reduce Work
values
themes.xml
<resources>
<style name="Theme.FacebookSync" parent="@style/Theme.FacebookSync.Support">
        ...
    </style>
    <style name="Theme.FacebookSync.NoTitleBar">
        ...
    </style>
    <style name="Theme.FacebookSync.Dialog" parent="@style/Theme.Dialog.Support">
        ...
</style>
</resources>
values-v11
themes-v11.xml
<resources>
    <style name="Theme.FacebookSync.Support" parent="@android:style/Theme.Holo"></style>
    <style name="Theme.Dialog.Support" parent="@android:style/Theme.Holo.Dialog"></style>
</resources>
values-v4
themes-v4.xml
<resources>
    <style name="Theme.FacebookSync.Support" parent="@android:style/Theme.NoTitleBar"></style>
    <style name="Theme.Dialog.Support" parent="@android:style/Theme.Dialog"></style>
</resources>
Tips to Reduce Work
Tips to Reduce Work
5
Give up control - be fluid
Tips to Reduce Work
Note: Not the best example ;)
Tips to Reduce Work
You’re Results MayVary
Thanks :)
@gauntface
matt@gauntface.co.uk

More Related Content

PDF
The Development Of Self-Discipline In Children (38)
PPTX
Learning the music!
PPT
Alexander michael project4
PDF
scg basic
PDF
Android Fragment-Awesome
The Development Of Self-Discipline In Children (38)
Learning the music!
Alexander michael project4
scg basic
Android Fragment-Awesome

Similar to Androidfragment (20)

PDF
Introduction to mobile programming with Androids.
PPTX
Supporting multi screen in android
PDF
Android training day 3
PPTX
Supporting multi screen in android cn
PDF
Etsy - Android & Design
PPTX
UI and UX for Mobile Developers
PDF
Android在多屏幕、多设备上的适配 | 布丁 任斐
PPTX
Designing Android apps for multiple screens
PPTX
Android supporting multiple screen
PPTX
Android design lecture #1
PDF
The Future is Responsive
KEY
Mo devtablet johncromartie-graphicsperformance
PPTX
Pixel Perfect
PPTX
Ux & hybrid app
PPTX
How to deal with Fragmentation on Android
PPTX
Designing for Android - Anjan Shrestha
PDF
Get responsive in 30 minutes (WordCamp Sofia)
PDF
Responsive web - CC FE & UX
PPTX
Introduction to hadoop
PDF
Supporting multiple screens on android
Introduction to mobile programming with Androids.
Supporting multi screen in android
Android training day 3
Supporting multi screen in android cn
Etsy - Android & Design
UI and UX for Mobile Developers
Android在多屏幕、多设备上的适配 | 布丁 任斐
Designing Android apps for multiple screens
Android supporting multiple screen
Android design lecture #1
The Future is Responsive
Mo devtablet johncromartie-graphicsperformance
Pixel Perfect
Ux & hybrid app
How to deal with Fragmentation on Android
Designing for Android - Anjan Shrestha
Get responsive in 30 minutes (WordCamp Sofia)
Responsive web - CC FE & UX
Introduction to hadoop
Supporting multiple screens on android
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
KodekX | Application Modernization Development
PPTX
sap open course for s4hana steps from ECC to s4
PDF
cuic standard and advanced reporting.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Cloud computing and distributed systems.
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Approach and Philosophy of On baking technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Empathic Computing: Creating Shared Understanding
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
KodekX | Application Modernization Development
sap open course for s4hana steps from ECC to s4
cuic standard and advanced reporting.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Cloud computing and distributed systems.
Network Security Unit 5.pdf for BCA BBA.
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
The AUB Centre for AI in Media Proposal.docx
Approach and Philosophy of On baking technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Empathic Computing: Creating Shared Understanding
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Ad

Androidfragment

  • 2. Who is this guy? • Master in Computer Science in Bristol • Senior Android Dev @ Mubaloo • Cross Platform Dev @ Future Platforms
  • 4. What’s coming up • Design - I can haz pretty • Dips • Buckets? • What buckets? • The story of buckets • Tips + Examples
  • 5. Dips Density Independent Pixels Abstract the screen size (think rounded corner rectangle) Never assume dip > pixels
  • 7. What Buckets? Screen density (ldpi, mdpi, hdpi, xhdpi) Orientation (port, land) AndroidVersion (v4, v11) Screen size (small, normal, large, xlarge)
  • 8. Eeks lots of Images
  • 9. How to use Buckets • Images - [ldpi, mdpi, hdpi, xhdpi] [small, normal, large, xlarge] • Layout - [land, port] • Themes / Styles - [v4, v11] • Dimensions - [small, normal, large, xlarge]
  • 13. The History... <port> land 1.5 1.6 ldpi mdpi hdpi 3.0 (ish) small normal large xlarge
  • 14. The History... <port> land 1.5 1.6 ldpi mdpi hdpi 3.0 (ish) small normal large xlarge 4.0 ldpi mdpi hdpi xhdpi
  • 15. Recap • Lots of buckets • Lots of resources to apply the buckets to • How it relates to other platforms like iOS
  • 17. Phones / Tablets? ldpi mdpi hdpi xhdpi total Small Normal Large XLarge 1.7% 2.4% 4.1% 0.7% 18.5% 66.3% 2.5% 88.0% 0.2% 2.8% 3.0% 4.9% 4.9% ldpi mdpi hdpi xhdpi Phones normal / small mdpi ? hdpi ? ? xhdpi ? Tablets large / xlarge
  • 19. Tips to Reduce Work 1 Use values everywhere (dimens, ints, etc.)
  • 20. Tips to Reduce Work values dimens.xml <resources>         <dimen name="default_text_size">20sp</dimen>         <dimen name="default_large_text_size">30sp</dimen>         <dimen name="splash_vertical_spacing">20dp</dimen>         <dimen name="gauntface_tag_bottom_spacing">20dp</dimen>         <dimen name="gauntface_tag_padding">5dp</dimen>         <dimen name="gauntface_tag_radius">10dp</dimen>         <dimen name="splash_gauntface_progress_bar">30dp</dimen>         <dimen name="generic_dialog_padding">15dp</dimen>         <dimen name="generic_dialog_bg_radius">4dp</dimen>         <dimen name="generic_dialog_title_spacer_height">4dp</dimen>         <dimen name="generic_dialog_title_spacer_vertical_spacing">10dp</dimen>         <dimen name="sync_info_padding">10dp</dimen>         <dimen name="sync_info_title_text_size">35sp</dimen>         <dimen name="sync_info_msg_text_size">20sp</dimen>         <dimen name="sync_info_bg_radius">10dp</dimen>         <dimen name="sync_info_prof_pic_radius">8dp</dimen>         <dimen name="sync_info_prof_pic_size">128dp</dimen>     </resources> values-land dimens.xml <resources>         <dimen name="default_text_size">15sp</dimen>         <dimen name="default_large_text_size">25sp</dimen>         <dimen name="splash_vertical_spacing">10dp</dimen>     </resources>
  • 21. Tips to Reduce Work values values-land
  • 22. Tips to Reduce Work 2 Learn the ways of the nine patch
  • 24. Tips to Reduce Work 3 Use <Shape> drawables
  • 25. Tips to Reduce Work <shape     xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="rectangle">     <gradient         android:angle="0"         android:endColor="@color/dark_blue"         android:gradientRadius="660"         android:startColor="@color/splash_light_blue"         android:type="radial" /> </shape>
  • 27. Tips to Reduce Work 4 Use Themes & Styles www.gauntface.co.uk/blog/2011/01/18/android-ui-reference
  • 28. Tips to Reduce Work values themes.xml <resources> <style name="Theme.FacebookSync" parent="@style/Theme.FacebookSync.Support">         ...     </style>     <style name="Theme.FacebookSync.NoTitleBar">         ...     </style>     <style name="Theme.FacebookSync.Dialog" parent="@style/Theme.Dialog.Support">         ... </style> </resources> values-v11 themes-v11.xml <resources>     <style name="Theme.FacebookSync.Support" parent="@android:style/Theme.Holo"></style>     <style name="Theme.Dialog.Support" parent="@android:style/Theme.Holo.Dialog"></style> </resources> values-v4 themes-v4.xml <resources>     <style name="Theme.FacebookSync.Support" parent="@android:style/Theme.NoTitleBar"></style>     <style name="Theme.Dialog.Support" parent="@android:style/Theme.Dialog"></style> </resources>
  • 30. Tips to Reduce Work 5 Give up control - be fluid
  • 31. Tips to Reduce Work Note: Not the best example ;)