我想要自定义 Jetpack Compose 中选项卡的外观,目前我的选项卡看起来像这样:
但是我希望我的选项卡像这样:
我是这样创建选项卡的:
![Current Tab](https://istack.dev59.com/GzrfD.webp)
![Expected Tabs](https://istack.dev59.com/mDO6W.webp)
TabRow(
selectedTabIndex = pagerState.currentPage,
backgroundColor = MaterialTheme.colors.primary,
contentColor = Color.White
) {
filters.forEachIndexed { index, filter ->
Tab(
text = {
Text(
text = filter.name.replaceFirstChar {
if (it.isLowerCase()) {
it.titlecase(Locale.getDefault())
} else {
it.toString()
}
}
)
},
selected = pagerState.currentPage == index,
onClick = { scope.launch { pagerState.animateScrollToPage(index) } },
)
}
}
我该如何实现那种效果?我已经搜索了很多但没有找到任何线索,有人能帮忙吗?
Ui\Color
中定义您的颜色。 - Thracian