In your app you can define more compose themes (for example in the Theme.kt
file).
To apply one of them you have to wrap your composables with the favorite theme.
For example:
setContent {
MyCustomM3Theme {
//...your composables
}
}
About the theme defined in the xml, you can extend a M3 theme for example: Theme.Material3.Light.NoActionBar
<style name="Theme.ComposeMaterial3" parent="Theme.Material3.Light.NoActionBar" />
but the composables don't use it. They use the compose theme.
The theme defined in the themes.xml
is used in the material components library (and other small parts as status bars).
Why does this not set as parent "Theme.Material3..."?
Your theme is defined as:
@Composable
fun MyCustomM3Theme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
//...
MaterialTheme( //<---
colorScheme = colorScheme,
typography = Typography,
content = content
)
}
The MaterialTheme
is defined in the package androidx.compose.material3