Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the Material theme in the activity.
Android Kotlin
setTheme(R.style.[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using AppCompat or Holo themes which are not Material Components themes.
Forgetting to set the theme before super.onCreate.
✗ Incorrect
The Material Components theme is set using Theme_MaterialComponents_DayNight to enable Material theming.
2fill in blank
mediumComplete the code to apply a custom colorPrimary in the Material theme XML.
Android Kotlin
<color name="[1]">#6200EE</color>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing colorPrimary with colorAccent or other colors.
Using invalid hex color codes.
✗ Incorrect
colorPrimary defines the main brand color in Material themes.
3fill in blank
hardFix the error in the theme XML to correctly inherit from a Material Components theme.
Android Kotlin
<style name="AppTheme" parent="[1]"> <!-- Customize your theme here. --> </style>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using AppCompat or Holo themes as parent which breaks Material theming.
Misspelling the theme name.
✗ Incorrect
Material Components themes start with Theme.MaterialComponents to enable Material theming features.
4fill in blank
hardFill both blanks to define a custom Material theme color and apply it in colors.xml.
Android Kotlin
<color name="[1]">#03DAC5</color> <color name="[2]">#018786</color>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing primary and secondary color names.
Using incorrect hex codes for variants.
✗ Incorrect
colorSecondary and colorSecondaryVariant define the secondary colors in Material themes.
5fill in blank
hardFill all three blanks to create a theme overlay with a custom font family and apply it in styles.xml.
Android Kotlin
<style name="CustomFontTheme" parent="[1]"> <item name="fontFamily">@font/[2]</item> <item name="textAppearanceHeadline1">@style/[3]</item> </style>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using AppCompat theme as parent which lacks Material support.
Incorrect font resource name or missing textAppearance style.
✗ Incorrect
Use a MaterialComponents DayNight theme as parent, specify the custom font resource, and apply the Material headline text style.