0
0
Android Kotlinmobile~20 mins

Material Theme customization in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Material Theme Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
How does changing the primary color affect the app UI?
You customize the Material Theme by changing the primary color in your theme XML. What visible effect will this have on your app's UI?
AOnly the background color of the app changes, other elements remain the same.
BThe app icon changes color to match the primary color.
CThe color of the app bar and interactive elements like buttons will change to the new primary color.
DThe text color in all TextViews changes to the primary color automatically.
Attempts:
2 left
💡 Hint
Think about which UI parts use the primary color by default in Material Design.
📝 Syntax
intermediate
2:00remaining
Which XML snippet correctly sets a custom secondary color in Material Theme?
You want to set a custom secondary color in your theme XML file. Which snippet is correct?
Android Kotlin
<style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar">
    <!-- Your code here -->
</style>
A<item name="colorSecondary">#FF5722</item>
B<item name="colorSecondaryVariant">#FF5722</item>
C<item name="secondaryColor">#FF5722</item>
D<item name="colorSecondaryContainer">#FF5722</item>
Attempts:
2 left
💡 Hint
In Material 3, the secondary color attribute is colorSecondary.
lifecycle
advanced
2:00remaining
When should you apply Material Theme customizations in your Android app lifecycle?
At what point in your Android app lifecycle should you apply Material Theme customizations to ensure they affect all UI components?
AIn the Application class's onCreate() method only.
BAfter setContentView() in the Activity's onCreate() method.
CInside the onResume() method of the Activity.
DBefore setContentView() in the Activity's onCreate() method.
Attempts:
2 left
💡 Hint
Think about when the UI is inflated and how themes affect it.
🧠 Conceptual
advanced
2:00remaining
What is the role of color roles like primary, secondary, and tertiary in Material Theme?
Why does Material Theme define color roles such as primary, secondary, and tertiary instead of just using fixed colors everywhere?
ATo provide a consistent color system that adapts to light/dark modes and accessibility needs.
BTo allow developers to use any random colors without restrictions.
CTo force all apps to use the same colors regardless of branding.
DTo reduce the number of colors used in the app to only three.
Attempts:
2 left
💡 Hint
Think about why design systems use roles instead of fixed colors.
🔧 Debug
expert
2:00remaining
Why does your custom Material Theme color not apply to the app bar?
You set a custom primary color in your theme XML, but the app bar still shows the default color. What is the most likely cause?
Android Kotlin
<style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar">
    <item name="colorPrimary">#6200EE</item>
</style>
AThe colorPrimary attribute is misspelled and ignored by the system.
BYou are using a NoActionBar theme but still have an app bar, so the colorPrimary is ignored.
CYou need to set colorPrimaryVariant instead of colorPrimary for the app bar.
DThe app bar color is controlled by colorSecondary, not colorPrimary.
Attempts:
2 left
💡 Hint
Check if your theme supports the app bar you are using.