ccd*_*ccd 12 android android-jetpack-compose android-compose-button
我想自定义 IconButton 的颜色,而不是使用 TopAppBar 上设置的默认值,但在android.compose.material中没有插槽 api 来更改它。
Scaffold(
topBar = {
TopAppBar(
title = {
Text(text = "LayoutsCodelab")
},
actions = {
IconButton(onClick = { /* doSomething() */ }) { // <- why it has the theme color and how to custom it.
Icon(Icons.Filled.Favorite)
}
}
)
}
)
Run Code Online (Sandbox Code Playgroud)
Gab*_*tti 15
tint您可以在可组合项中使用该参数Icon:
actions = {
IconButton(onClick = { /* doSomething() */ }) {
Icon(Icons.Filled.Add,
"contentDescription",
tint = Color.Red)
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7634 次 |
| 最近记录: |