SlideShare a Scribd company logo
1 of 19
Android
Themes &
Styles
By Mohammed Ersan
Who Am I?
Mohammed Ersan
Senior Android Developer
MTT Dublin
Github @MoshDev
Themes & Styles
Themes &
Styles
Style vs Theme
Style Basics
Inheritance
Attributes
View Constructors
Material
Theme Shared Styles
In-Layout Theme
ContextThemeWrapper
Selectors & Drawables
Hints & Tools
Style
A style is a collection of properties that
specify the look and format for a View or
window. A style can specify properties
such as height, padding, font color, font
size, background color, and much more. A
style is defined in an XML resource that is
separate from the XML that specifies the
layout.
Theme
A theme is a style applied to an entire
Activity or application, rather than an
individual View. When a style is applied as
a theme, every View in the Activity or
application will apply each style property
that it supports.
Style vs Theme
Source: https://developer.android.com/guide/topics/ui/themes.html
Style Theme
Style vs Theme
Xml file
res/values
Root node <resources>
<style>
Name is required
<item>
Parent is Optional
AAPT (Android Asset Packaging Tool)
Style Basics
Source: https://developer.android.com/guide/topics/ui/themes.html
http://elinux.org/Android_aapt
Parent
<style name="MyButtonStyle" parent="@style/Widget.AppCompat.Button">
Period (dot)
only works for styles defined by your own resources
<style name="style_vs_theme_body_text.sample">
Period + Parent
<style name="style_vs_theme_body_text.sample" parent="Widget.AppCompat.Button">
Inheritance
● Format
○ Enum (only integers)
○ Boolean (true|false)
○ Color
○ Dimension
○ Flag (only integers)
○ Float
○ Fraction (only percentage %)
Attributes (Properties)
● Declare-styleable
○ R.styleable.<name>
○ R.styleable.<name>_<attribute>
View(Context)
View(Context, AttributeSet) **
View(Context, AttributeSet, defStyleAttr)
View(Context, AttributeSet, defStyleAttr, defStyleRes) (Api 21)
View Constructors
1. colorPrimary
2. colorPrimaryDark
3. colorControlNormal
4. colorControlActivated
5. colorButtonNormal
6. textColorPrimary
7. textColorSecondary
8. textColorPrimaryDisableOnly
9. textColorTertiary
10.textColorHint
11.windowBackground
Material
toolbarStyle
buttonStyle
textViewStyle
checkboxStyle
…
Theme Default Styles
To change default view style
Check the <View> source code
Search Platform/AppCompat theme source code
In-Layout Theme
android:theme
Individual views
ViewGroup Inheritance
ContextThemeWrapper
TextView1 --> ...InLayoutThemeActivity@7d3740e
TextView2 --> android.view.ContextThemeWrapper@5c46c40
TextView3 --> android.view.ContextThemeWrapper@b0afcbe
TextView4 --> android.view.ContextThemeWrapper@b0afcbe
ContextThemeWrapper
Selectors & Drawables
Hints & Tools
Alpha colors
Hints & Tools
Extract Style
Conclusion
Themes are very powerful tool in Android, start using them correctly since the
beginning of development and it will end well.
Questions
つづく

More Related Content

Viewers also liked

M Ammar Darwish_MBA Certificate
M  Ammar Darwish_MBA CertificateM  Ammar Darwish_MBA Certificate
M Ammar Darwish_MBA Certificate
M. Ammar Darwish
 

Viewers also liked (9)

Science Update - No 271 - May 2016
Science Update - No 271 - May 2016Science Update - No 271 - May 2016
Science Update - No 271 - May 2016
 
khongi cv h
khongi cv hkhongi cv h
khongi cv h
 
FutureCasting for iu13
FutureCasting for iu13FutureCasting for iu13
FutureCasting for iu13
 
Science Update - No 278 - Dec 2016
Science Update - No 278 - Dec 2016Science Update - No 278 - Dec 2016
Science Update - No 278 - Dec 2016
 
Agência estado mai2015 n ps
Agência estado mai2015   n psAgência estado mai2015   n ps
Agência estado mai2015 n ps
 
Nancy
NancyNancy
Nancy
 
Ejercicio estado de resultado
Ejercicio estado de resultadoEjercicio estado de resultado
Ejercicio estado de resultado
 
IL BILANCIO DI COMPETENZE IN AZIENDA PER L’IDENTIFICAZIONE, LA VALIDAZIONE E ...
IL BILANCIO DI COMPETENZE IN AZIENDA PER L’IDENTIFICAZIONE, LA VALIDAZIONE E ...IL BILANCIO DI COMPETENZE IN AZIENDA PER L’IDENTIFICAZIONE, LA VALIDAZIONE E ...
IL BILANCIO DI COMPETENZE IN AZIENDA PER L’IDENTIFICAZIONE, LA VALIDAZIONE E ...
 
M Ammar Darwish_MBA Certificate
M  Ammar Darwish_MBA CertificateM  Ammar Darwish_MBA Certificate
M Ammar Darwish_MBA Certificate
 

Similar to Themes & Styles - Android Mubasher

Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
Mediacurrent
 
RPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usageRPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usage
GEBS Reporting
 

Similar to Themes & Styles - Android Mubasher (20)

Android styles and themes
Android styles and themesAndroid styles and themes
Android styles and themes
 
Android training (android style)
Android training (android style)Android training (android style)
Android training (android style)
 
Sitecore Knowledge Transfer 2018 (Template) day-2
Sitecore  Knowledge Transfer 2018 (Template) day-2Sitecore  Knowledge Transfer 2018 (Template) day-2
Sitecore Knowledge Transfer 2018 (Template) day-2
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
 
Android style resource and other resources types-chapter12
Android style resource and other resources types-chapter12Android style resource and other resources types-chapter12
Android style resource and other resources types-chapter12
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
 
Introduction to css - a complete guide towards css
Introduction to css - a complete guide towards cssIntroduction to css - a complete guide towards css
Introduction to css - a complete guide towards css
 
Building beautiful User Interface in Android
Building beautiful User Interface in AndroidBuilding beautiful User Interface in Android
Building beautiful User Interface in Android
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Css class-01
Css class-01Css class-01
Css class-01
 
RPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usageRPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usage
 
Css
CssCss
Css
 
Lec 1
Lec 1Lec 1
Lec 1
 
Html & CSS - Best practices 2-hour-workshop
Html & CSS - Best practices 2-hour-workshopHtml & CSS - Best practices 2-hour-workshop
Html & CSS - Best practices 2-hour-workshop
 
Single sourcing to the max
Single sourcing to the maxSingle sourcing to the max
Single sourcing to the max
 
Localization and Shared Preferences in android
Localization and Shared Preferences in androidLocalization and Shared Preferences in android
Localization and Shared Preferences in android
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSS
 
Lab#1 - Front End Development
Lab#1 - Front End DevelopmentLab#1 - Front End Development
Lab#1 - Front End Development
 
Dita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and DeveloperDita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and Developer
 
Software design and Architecture.pptx
Software design and Architecture.pptxSoftware design and Architecture.pptx
Software design and Architecture.pptx
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital Businesses
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 

Themes & Styles - Android Mubasher