CHAPTER 10
Beginner
Material Design Principles
Updated: May 31, 2026
6 min read
# CHAPTER 10
Material Design Principles
1. Introduction
You know how to put buttons, text, and images on a screen. But how do you make them look *professional*? How do you ensure your app feels at home on an Android device? The answer is Material Design. Created by Google in 2014 and continuously updated (now Material You/Material 3), Material Design is a comprehensive design system. It dictates how UI elements should look, feel, and behave. In this chapter, we will learn the philosophy behind Material Design and how to apply it to your app.2. Learning Objectives
By the end of this chapter, you will be able to:- Understand the core philosophy of "Material as a Metaphor".
- Implement a cohesive Color Palette (Primary, Secondary, Surface).
- Apply a typographic scale to ensure text hierarchy.
- Utilize Elevation to create depth and focus.
- Use shape theming for brand identity.
3. The Philosophy: Material as a Metaphor
Material Design is inspired by the physical world—specifically paper and ink. In the physical world, objects cast shadows, they have a certain thickness, and they cannot pass through one another. Material Design brings these physical rules to the digital screen.- UI elements are "surfaces" (like pieces of paper).
- Shadows (elevation) indicate which surface is above another.
- Motion should be meaningful and respect the laws of physics (e.g., easing in and out).
4. Color Palettes
A good UI doesn't use 20 different colors. Material Design uses a structured palette to communicate hierarchy and state.- Primary Color: The color displayed most frequently across your app's screens and components (e.g., the app bar).
- Secondary Color: Used to accent and distinguish your product. Great for Floating Action Buttons (FABs), sliders, and active states.
- Surface Color: The background color of components like Cards, Sheets, and Menus.
- Error Color: Indicates warnings and errors (usually a shade of red).
-
"On" Colors: The color of text or icons placed *on top* of the primary or surface colors (e.g.,
colorOnPrimaryis usually white or black).
5. Typography and Hierarchy
Reading text is the primary way users interact with your app. Material Design defines a Type Scale—a set of predefined text styles. Instead of guessing font sizes, use the semantic styles provided by theMaterialComponents theme:
-
Headline1toHeadline6: For large screen titles.
-
Subtitle1andSubtitle2: For medium emphasis text.
-
Body1andBody2: For the main content/paragraphs.
-
Button: For button text (usually all-caps in older Material, sentence case in M3).
-
Caption: For small, supplementary text like timestamps.
xml
6. Elevation and Depth
The screen is flat, but your UI shouldn't be. Elevation is the relative depth, or Z-axis, between two surfaces.-
A background layout has an elevation of
0dp.
-
A Card might have an elevation of
2dp, casting a small shadow.
-
A Floating Action Button (FAB) might have an elevation of
6dp, casting a larger shadow, indicating it floats high above the content.
*Rule of thumb:* The higher the elevation, the more important the element is, and the larger its shadow will be.
7. Shapes and Theming
Material Design isn't just about rounded corners. You can globally theme the shape of all components in your app. In yourthemes.xml, you can define shape appearances (Small, Medium, Large components). If you decide your brand uses sharp cut corners instead of rounded ones, you change the shape theme once, and every Button, Card, and Dialog in your app instantly updates.
8. Motion Design
Animation isn't just for showing off; it's functional.- Provide Feedback: When a user taps a button, a ripple effect confirms the tap.
- Show Hierarchy: When a user clicks a list item, the new screen should slide or expand from that item, showing the relationship between the two screens.
9. Common Mistakes
- Shadow Abuse: Adding heavy drop shadows to every single element on the screen creates visual noise and confusion. Use elevation sparingly to highlight important interactions.
- Low Contrast: Using light gray text on a white background. Always ensure your text passes WCAG contrast accessibility guidelines.
- Clashing Colors: Using too many vibrant colors. Stick to your Primary and Secondary palette.
10. Best Practices
- Start with a white/light gray background, set your Primary brand color for the App Bar, and use a contrasting Secondary color for call-to-action buttons.
-
Use
?attr/references in your XML instead of hardcoding colors (e.g., use?attr/colorPrimaryinstead of#FF0000). This makes implementing Dark Mode trivial later.
11. Exercises
- 1. Visit the website material.io and use their color tool to generate a Primary and Secondary color palette for a hypothetical Coffee Shop app.
-
2.
In an Android layout, stack three
MaterialCardViews on top of each other. Set their elevations to2dp,8dp, and16dp. Observe the differences in their shadows.
12. UI Design Challenges
Challenge: Redesign the Profile Layout from Chapter 4 using strict Material Design principles. Replace hardcoded text sizes (16sp, 28sp) with semantic textAppearance attributes (?attr/textAppearanceHeadline5, ?attr/textAppearanceBody2).
13. MCQ Quiz with Answers
Question 1
What is the purpose of the "Secondary Color" in Material Design?
Question 2
How does Material Design simulate physical depth on a flat screen?
14. Interview Questions
-
Q: What is the difference between
colorPrimaryandcolorOnPrimary?
- Q: Explain the concept of "Material as a Metaphor."
-
Q: Why is it recommended to use semantic typography (like
Body1) instead of hardcoded text sizes (like14sp)?