I am tiring to remove the underline of TabRow, but did not succeed. Here is the code:
@ExperimentalPagerApi
@Composable
fun Tabs(pagerState: PagerState) {
val tabs = listOf(R.string.add, R.string.add)
val scope = rememberCoroutineScope()
val currentPage = pagerState.currentPage
TabRow(
modifier = Modifier
.padding(start = 36.dp, top = 16.dp, end = 36.dp)
.clip(shape = RoundedCornerShape(16.dp)),
selectedTabIndex = currentPage,
backgroundColor = Color.Transparent,
tabs = {
tabs.forEachIndexed { index, tab ->
Tab(
modifier = Modifier.clip(RoundedCornerShape(16.dp)),
text = {
Text(text = stringResource(id = tab))
},
selected = currentPage == index,
onClick = {
scope.launch {
pagerState.animateScrollToPage(index)
}
}
)
}
}
)
}

I only want to have the selected color.
set divider param of TabRow as divider={}. Default one is
divider: @Composable () -> Unit = @Composable {
Divider()
}
When using a Scrollable tabRow in material 3 you can remove the underline below the entire scrollable tab row and the indicator for individual selected tabs like this
ScrollableTabRow(
selectedTabIndex = tabIndex, edgePadding = 16.dp,
indicator = {
}, divider = {
}
) { }
removing the tab indicator only
ScrollableTabRow(
selectedTabIndex = tabIndex, edgePadding = 16.dp,
indicator = {
}
) { }
and to remove the underline below the entire scrollable tab row
ScrollableTabRow(
selectedTabIndex = tabIndex, edgePadding = 16.dp,
divider = {
}
) { }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With