From the course: Android Compose with Kotlin
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Theming in Compose - Kotlin Tutorial
From the course: Android Compose with Kotlin
Theming in Compose
- [Instructor] The style of Android XML views can be defined in the layout files where they are created, like this text view with an attribute to set the font weight to bold. It also has a style attribute that points to another XML definition with multiple design attributes defined in one place. For example, in the styles.xml file, we have styles that specify attributes for a specific view type or other styles. Then in themes.xml, we use that style and we can apply it to all elements in the app. This framework allows for flexibility when implementing designs in your layout files. Compose offers similar flexibility. Your app's theme is divided into three components, the ColorScheme, Shapes, and Typography. But instead of XML, these elements are defined as composables and Kotlin classes. Then, each UI composable, along with the style it inherits from the app theme, has specific parameters we can override to control its individual style. Going back to our view from earlier, we have a…