Android 5.0 Lollipop introduced the ability to specify theme overrides directly on individual Views using android:theme. This post explains the difference between themes (global styling) and styles (view-level styling), how ContextThemeWrapper underlies theme overlays, and how ThemeOverlay.Material variants work. Practical examples show how to apply a dark theme to a Toolbar and how to use a custom ThemeOverlay to set theme attributes like colorEdgeEffect on a single view. AppCompat backports android:theme support for Toolbar on older API levels.

4m read timeFrom chrisbanes.me
Post cover image
Table of contents
Why? #ThemeOverlay #android:theme #Example #Theme vs Style #AppCompat #appcompat v21: material design for pre-Lollipop devices!