SlideShare a Scribd company logo
1 of 33
Download to read offline
ADVANCED STYLING
                              AND SKINNING
                                 Joshua Jamison
                                     11.9.11




Wednesday, November 9, 11
WHAT’S THIS ABOUT?
                            This                  Not This




                                   Ranging from
                   Basic                            Advanced

Wednesday, November 9, 11
SO…
    WHO IS THIS GUY?
    •Software Architect & Developer
    •Hacking on Android since Beta
    •Multiple Applications to market
    •Contractor for Universal Mind
    •Still owns an HTC G1              Rarrr…brains.


    •“My life for Aiur”
    •Not actually a zombie

Wednesday, November 9, 11
WHY BOTHER?




Wednesday, November 9, 11
WHY BOTHER?
            •Android is ugly




Wednesday, November 9, 11
WHY BOTHER?
            •Android is ugly
                Doesn’t have to be




Wednesday, November 9, 11
WHY BOTHER?
            •Android is ugly
                Doesn’t have to be


            •Don’t need to design for Android




Wednesday, November 9, 11
WHY BOTHER?
            •Android is ugly
                Doesn’t have to be


            •Don’t need to design for Android
                Unless you have a brand




Wednesday, November 9, 11
WHY BOTHER?
            •Android is ugly
                Doesn’t have to be


            •Don’t need to design for Android
                Unless you have a brand


            •Just port the iPhone app


Wednesday, November 9, 11
WHY BOTHER?
            •Android is ugly
                Doesn’t have to be


            •Don’t need to design for Android
                Unless you have a brand


            •Just port the iPhone app
                Android != iPhone


Wednesday, November 9, 11
LAYOUTS


   • <LinearLayout>, <RelativeLayout>, <FrameLayout>…

   • match_parent           & wrap_layout

   • layout_weight




Wednesday, November 9, 11
STYLES & THEMES

   • Names   are just a convention: styles.xml, themes.xml,
       makes_no_difference.xml

   • XML             files placed in /res/values/ folder

   • Apply             a Theme to an Activity / Apply a Style to a View

   • Both           use <style> tag

   • Themes                 cascade, Styles do not


Wednesday, November 9, 11
<STYLE> TAG

   • Style         must have name attribute

   • Children               must be <item>

   • Item          must have name attribute

   • Code            assist helps, but use docs

   • @style/style_name



Wednesday, November 9, 11
USING SDK STYLES

   • @android:style/…

   • Code             complete getting better and better

   • Use          source to see specifics

   • Convenient, but           sometimes unpredictable



Wednesday, November 9, 11
STYLE INHERITANCE


   • Two           types: parent attribute & style name prefix

   • Use          style name prefix for inheriting from your own styles

   • Use          parent attribute for inheriting from Android SDK styles




Wednesday, November 9, 11
COMMON STYLES


   • Backgrounds

        • android:background            & android:windowBackground

        • Style             with background, Theme with windowBackground




Wednesday, November 9, 11
COMMON STYLES

   • Button

        • background         drawable (use a selector)

        • text

        • drawableLeft, drawableTop, …

        • drawablePadding



Wednesday, November 9, 11
COMMON STYLES


   • ImageView              & ImageButton

        • ImageButton          extends ImageView

        • android:src

        • ImageButton          uses default Button background



Wednesday, November 9, 11
COMMON STYLES

   • Tabs

        • Can          be very frustrating

        • TabWidget              contains the Tabs

        • Keep              the widget at the top!

        • TabHost.TabSpec.setIndicator()


                                                     “Please no”
Wednesday, November 9, 11
COMMON STYLES
   •   Dialogs

        •   Can be annoying

        •   Standard Dialog content is easily
            customized, but not the title.

        •   AlertDialog convenient for
            building simple dialogs

        •   Dialogs can take a custom theme

        •   Try DialogFragments with the
            support library
Wednesday, November 9, 11
COMMON STYLES
 • TextAppearance

     • Views                with Text usually have a textAppearance style

     • Container                for common text styles

     • To        ease reuse of text styles through app
     •   http://developer.android.com/reference/android/R.styleable.html#TextAppearance




Wednesday, November 9, 11
COLORS, STRINGS & ARRAYS

   • <color            name=”foo”> & <string name=”bar”>

   • XML             file names are just conventions (colors.xml, strings.xml)

   • Also          in the /res/values/ folder

   • <integer-array>            convenient for colors

   • <string-array>            convenient for strings

   • Arrays             can reference new values or already defined values

Wednesday, November 9, 11
DRAWABLES

   • /res/drawable…

   • Configuration     Qualifiers
       (hdpi / mdpi / ldpi)

   • Android                prefers to scale down larger images

   • Density                ambiguous drawables belong in /res/drawable/
   •   http://developer.android.com/resources/dashboard/screens.html


Wednesday, November 9, 11
9 PATCH

  • Good             for graphics that will need to scale to fit content

  • Must           be PNG format and name must end with “.9.png”

  • Use         draw9patch application in /<sdk install path>/tools/

  • Who’s              job is this, really?
  •   http://developer.android.com/guide/developing/tools/draw9patch.html



Wednesday, November 9, 11
9 PATCH TIPS

  • Source    image should be
      smallest repeatable area

  • Patch   lines must be
      continuous

  • Stay          away from corners

  • Be        careful with gradients
                                       API 14 - /res/drawable-hdpi/btn_default_normal_holo.9.png




Wednesday, November 9, 11
XML DRAWABLES
                                         The cool stuff…



   • Density                ambiguous, so belongs in /res/drawable/ folder

   • /res/drawable/filename.xml

   • Now             with wizard & code complete
   •   http://developer.android.com/guide/topics/resources/drawable-resource.html




Wednesday, November 9, 11
XML DRAWABLES

   • State           List <selector>

        • Used              for buttons with states (including toggle and radio)

        • States: pressed, focused, selected, checked, enabled

        • Don’t             forget the “focused” state!

        • Can          be used for colors as well



Wednesday, November 9, 11
XML DRAWABLES
   • Shape             <shape> (declarative graphics!)

        • Geometric              shapes: rectangle, oval, line, ring

        • Useful            to nest multiple inside <layer-list>

        • Good              for simple graphics

        • Complex     graphics should be handled with images or the
            graphics API

        • Warning: Line             shape is only horizontal!

Wednesday, November 9, 11
XML DRAWABLES
   • LevelList               <level-list>

        • Essentially           gives drawable custom states

        • <item  android:drawable=”@drawable/foo”/> or
            <item><shape/></item>

        • Items             can apply to multiple levels: minLevel & maxLevel

        • Change    programmatically on the View with setLevel() or
            setImageLevel()


Wednesday, November 9, 11
XML DRAWABLES


   • Many             more available
   •   http://developer.android.com/guide/topics/resources/drawable-resource.html




Wednesday, November 9, 11
ATTRS

   • Custom                 attributes for your styles

   • Abstracts               style reference away

   • Useful             for Themes

   • Many             defaults already available

   • Use          the source for examples of making your own


Wednesday, November 9, 11
ATTRS
   •   Filename convention: attrs.xml

   •   Place in XML in /res/values/

   •   <declare-styleable name=”My.Custom.Style.Or.Theme”>
        <attr name=”fooStyle” format=”reference|color”/>
        <attr name=”barDim” format=”dimension”/>

   •   ?attr/fooStyle

   •   Very useful in custom components

   •   http://developer.android.com/reference/android/R.attr.html
       (click “View Source”)
Wednesday, November 9, 11
THANKS FOR COMING!
  •   My Contact Info

           name:	

 Joshua Jamison
           email:	

joshua.jamison@gmail.com
           blog:	

 	

 workingfromhere.com
           twitter:	

 cephus
                                                      Feedback via EventBoard.com

  •   Resources

           Android Docs:	

 	

 	

 http://developer.android.com
           Android Source:	

 	

 http://source.android.com/
           Google code search:	

 http://www.google.com/codesearch#/
           &exact_package=android

           code:	

https://github.com/cephus/SkinningStylingAnDevCon2
           slides:	

Wednesday, November 9, 11

More Related Content

What's hot

Making it mobile_360_flex_jonathancampos_antonioholguin
Making it mobile_360_flex_jonathancampos_antonioholguinMaking it mobile_360_flex_jonathancampos_antonioholguin
Making it mobile_360_flex_jonathancampos_antonioholguinAntonioHolguin
 
Code camp 2012-advanced-design-patterns
Code camp 2012-advanced-design-patternsCode camp 2012-advanced-design-patterns
Code camp 2012-advanced-design-patternsAmir Barylko
 
DevTeach12-Capybara
DevTeach12-CapybaraDevTeach12-Capybara
DevTeach12-CapybaraAmir Barylko
 
Mobilizing WordPress
Mobilizing WordPressMobilizing WordPress
Mobilizing WordPressCurtis McHale
 

What's hot (7)

Making it mobile_360_flex_jonathancampos_antonioholguin
Making it mobile_360_flex_jonathancampos_antonioholguinMaking it mobile_360_flex_jonathancampos_antonioholguin
Making it mobile_360_flex_jonathancampos_antonioholguin
 
Code camp 2012-advanced-design-patterns
Code camp 2012-advanced-design-patternsCode camp 2012-advanced-design-patterns
Code camp 2012-advanced-design-patterns
 
Full stack accessibility
Full stack accessibilityFull stack accessibility
Full stack accessibility
 
Resume_HyeWonChang
Resume_HyeWonChangResume_HyeWonChang
Resume_HyeWonChang
 
DevTeach12-Capybara
DevTeach12-CapybaraDevTeach12-Capybara
DevTeach12-Capybara
 
Mobile? WT... F?
Mobile? WT... F?Mobile? WT... F?
Mobile? WT... F?
 
Mobilizing WordPress
Mobilizing WordPressMobilizing WordPress
Mobilizing WordPress
 

Similar to Advanced Skinning & Styling for Android

Interactive Project Management Workshop
Interactive Project Management WorkshopInteractive Project Management Workshop
Interactive Project Management WorkshopShelley Simmons
 
Adaptive Experiences
Adaptive ExperiencesAdaptive Experiences
Adaptive ExperiencesWINTR
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2Blazing Cloud
 
How I Learned To Stop Worrying & Love HTML5
How I Learned To Stop Worrying & Love HTML5How I Learned To Stop Worrying & Love HTML5
How I Learned To Stop Worrying & Love HTML5Dale Cruse
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyBlazing Cloud
 
Content focused web design
Content focused web designContent focused web design
Content focused web designEddie Monge
 
Designing for WordPress
Designing for WordPressDesigning for WordPress
Designing for WordPressKevin Conboy
 
Rails Class Intro - 1
Rails Class Intro - 1 Rails Class Intro - 1
Rails Class Intro - 1 Blazing Cloud
 
Drupal and the rise of the documents
Drupal and the rise of the documentsDrupal and the rise of the documents
Drupal and the rise of the documentsClaudio Beatrice
 
DrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with DrupalDrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with Drupalzroger
 
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012Blend Interactive
 
Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit Frank Karlitschek
 
Slaying Bugs with Gradle and Jenkins
Slaying Bugs with Gradle and JenkinsSlaying Bugs with Gradle and Jenkins
Slaying Bugs with Gradle and JenkinsDavid Kay
 
CloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenCloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenPatrick Chanezon
 
Designing hacks
Designing hacksDesigning hacks
Designing hacksjbcima
 
Localizing iOS Apps
Localizing iOS AppsLocalizing iOS Apps
Localizing iOS Appsweissazool
 
Unlocked London - Technical Track
Unlocked London - Technical TrackUnlocked London - Technical Track
Unlocked London - Technical TrackWayne Walls
 

Similar to Advanced Skinning & Styling for Android (20)

HTML5 and Sencha Touch
HTML5 and Sencha TouchHTML5 and Sencha Touch
HTML5 and Sencha Touch
 
Interactive Project Management Workshop
Interactive Project Management WorkshopInteractive Project Management Workshop
Interactive Project Management Workshop
 
Adaptive Experiences
Adaptive ExperiencesAdaptive Experiences
Adaptive Experiences
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2
 
How I Learned To Stop Worrying & Love HTML5
How I Learned To Stop Worrying & Love HTML5How I Learned To Stop Worrying & Love HTML5
How I Learned To Stop Worrying & Love HTML5
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
 
CSS Power Tools
CSS Power ToolsCSS Power Tools
CSS Power Tools
 
Content focused web design
Content focused web designContent focused web design
Content focused web design
 
Designing for WordPress
Designing for WordPressDesigning for WordPress
Designing for WordPress
 
Rails Class Intro - 1
Rails Class Intro - 1 Rails Class Intro - 1
Rails Class Intro - 1
 
Drupal and the rise of the documents
Drupal and the rise of the documentsDrupal and the rise of the documents
Drupal and the rise of the documents
 
DrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with DrupalDrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with Drupal
 
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
"Intro to iOS Development" - Derek Fernholz, South Dakota Code Camp 2012
 
Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit Earning Money with Free Software - Gran Canaria Desktop Summit
Earning Money with Free Software - Gran Canaria Desktop Summit
 
Slaying Bugs with Gradle and Jenkins
Slaying Bugs with Gradle and JenkinsSlaying Bugs with Gradle and Jenkins
Slaying Bugs with Gradle and Jenkins
 
CloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenCloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heaven
 
Designing hacks
Designing hacksDesigning hacks
Designing hacks
 
Localizing iOS Apps
Localizing iOS AppsLocalizing iOS Apps
Localizing iOS Apps
 
Pocket Knife JS
Pocket Knife JSPocket Knife JS
Pocket Knife JS
 
Unlocked London - Technical Track
Unlocked London - Technical TrackUnlocked London - Technical Track
Unlocked London - Technical Track
 

Recently uploaded

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Advanced Skinning & Styling for Android

  • 1. ADVANCED STYLING AND SKINNING Joshua Jamison 11.9.11 Wednesday, November 9, 11
  • 2. WHAT’S THIS ABOUT? This Not This Ranging from Basic Advanced Wednesday, November 9, 11
  • 3. SO… WHO IS THIS GUY? •Software Architect & Developer •Hacking on Android since Beta •Multiple Applications to market •Contractor for Universal Mind •Still owns an HTC G1 Rarrr…brains. •“My life for Aiur” •Not actually a zombie Wednesday, November 9, 11
  • 5. WHY BOTHER? •Android is ugly Wednesday, November 9, 11
  • 6. WHY BOTHER? •Android is ugly Doesn’t have to be Wednesday, November 9, 11
  • 7. WHY BOTHER? •Android is ugly Doesn’t have to be •Don’t need to design for Android Wednesday, November 9, 11
  • 8. WHY BOTHER? •Android is ugly Doesn’t have to be •Don’t need to design for Android Unless you have a brand Wednesday, November 9, 11
  • 9. WHY BOTHER? •Android is ugly Doesn’t have to be •Don’t need to design for Android Unless you have a brand •Just port the iPhone app Wednesday, November 9, 11
  • 10. WHY BOTHER? •Android is ugly Doesn’t have to be •Don’t need to design for Android Unless you have a brand •Just port the iPhone app Android != iPhone Wednesday, November 9, 11
  • 11. LAYOUTS • <LinearLayout>, <RelativeLayout>, <FrameLayout>… • match_parent & wrap_layout • layout_weight Wednesday, November 9, 11
  • 12. STYLES & THEMES • Names are just a convention: styles.xml, themes.xml, makes_no_difference.xml • XML files placed in /res/values/ folder • Apply a Theme to an Activity / Apply a Style to a View • Both use <style> tag • Themes cascade, Styles do not Wednesday, November 9, 11
  • 13. <STYLE> TAG • Style must have name attribute • Children must be <item> • Item must have name attribute • Code assist helps, but use docs • @style/style_name Wednesday, November 9, 11
  • 14. USING SDK STYLES • @android:style/… • Code complete getting better and better • Use source to see specifics • Convenient, but sometimes unpredictable Wednesday, November 9, 11
  • 15. STYLE INHERITANCE • Two types: parent attribute & style name prefix • Use style name prefix for inheriting from your own styles • Use parent attribute for inheriting from Android SDK styles Wednesday, November 9, 11
  • 16. COMMON STYLES • Backgrounds • android:background & android:windowBackground • Style with background, Theme with windowBackground Wednesday, November 9, 11
  • 17. COMMON STYLES • Button • background drawable (use a selector) • text • drawableLeft, drawableTop, … • drawablePadding Wednesday, November 9, 11
  • 18. COMMON STYLES • ImageView & ImageButton • ImageButton extends ImageView • android:src • ImageButton uses default Button background Wednesday, November 9, 11
  • 19. COMMON STYLES • Tabs • Can be very frustrating • TabWidget contains the Tabs • Keep the widget at the top! • TabHost.TabSpec.setIndicator() “Please no” Wednesday, November 9, 11
  • 20. COMMON STYLES • Dialogs • Can be annoying • Standard Dialog content is easily customized, but not the title. • AlertDialog convenient for building simple dialogs • Dialogs can take a custom theme • Try DialogFragments with the support library Wednesday, November 9, 11
  • 21. COMMON STYLES • TextAppearance • Views with Text usually have a textAppearance style • Container for common text styles • To ease reuse of text styles through app • http://developer.android.com/reference/android/R.styleable.html#TextAppearance Wednesday, November 9, 11
  • 22. COLORS, STRINGS & ARRAYS • <color name=”foo”> & <string name=”bar”> • XML file names are just conventions (colors.xml, strings.xml) • Also in the /res/values/ folder • <integer-array> convenient for colors • <string-array> convenient for strings • Arrays can reference new values or already defined values Wednesday, November 9, 11
  • 23. DRAWABLES • /res/drawable… • Configuration Qualifiers (hdpi / mdpi / ldpi) • Android prefers to scale down larger images • Density ambiguous drawables belong in /res/drawable/ • http://developer.android.com/resources/dashboard/screens.html Wednesday, November 9, 11
  • 24. 9 PATCH • Good for graphics that will need to scale to fit content • Must be PNG format and name must end with “.9.png” • Use draw9patch application in /<sdk install path>/tools/ • Who’s job is this, really? • http://developer.android.com/guide/developing/tools/draw9patch.html Wednesday, November 9, 11
  • 25. 9 PATCH TIPS • Source image should be smallest repeatable area • Patch lines must be continuous • Stay away from corners • Be careful with gradients API 14 - /res/drawable-hdpi/btn_default_normal_holo.9.png Wednesday, November 9, 11
  • 26. XML DRAWABLES The cool stuff… • Density ambiguous, so belongs in /res/drawable/ folder • /res/drawable/filename.xml • Now with wizard & code complete • http://developer.android.com/guide/topics/resources/drawable-resource.html Wednesday, November 9, 11
  • 27. XML DRAWABLES • State List <selector> • Used for buttons with states (including toggle and radio) • States: pressed, focused, selected, checked, enabled • Don’t forget the “focused” state! • Can be used for colors as well Wednesday, November 9, 11
  • 28. XML DRAWABLES • Shape <shape> (declarative graphics!) • Geometric shapes: rectangle, oval, line, ring • Useful to nest multiple inside <layer-list> • Good for simple graphics • Complex graphics should be handled with images or the graphics API • Warning: Line shape is only horizontal! Wednesday, November 9, 11
  • 29. XML DRAWABLES • LevelList <level-list> • Essentially gives drawable custom states • <item android:drawable=”@drawable/foo”/> or <item><shape/></item> • Items can apply to multiple levels: minLevel & maxLevel • Change programmatically on the View with setLevel() or setImageLevel() Wednesday, November 9, 11
  • 30. XML DRAWABLES • Many more available • http://developer.android.com/guide/topics/resources/drawable-resource.html Wednesday, November 9, 11
  • 31. ATTRS • Custom attributes for your styles • Abstracts style reference away • Useful for Themes • Many defaults already available • Use the source for examples of making your own Wednesday, November 9, 11
  • 32. ATTRS • Filename convention: attrs.xml • Place in XML in /res/values/ • <declare-styleable name=”My.Custom.Style.Or.Theme”> <attr name=”fooStyle” format=”reference|color”/> <attr name=”barDim” format=”dimension”/> • ?attr/fooStyle • Very useful in custom components • http://developer.android.com/reference/android/R.attr.html (click “View Source”) Wednesday, November 9, 11
  • 33. THANKS FOR COMING! • My Contact Info name: Joshua Jamison email: joshua.jamison@gmail.com blog: workingfromhere.com twitter: cephus Feedback via EventBoard.com • Resources Android Docs: http://developer.android.com Android Source: http://source.android.com/ Google code search: http://www.google.com/codesearch#/ &exact_package=android code: https://github.com/cephus/SkinningStylingAnDevCon2 slides: Wednesday, November 9, 11