Quantcast
Channel: Active questions tagged tabs - Stack Overflow
Viewing all articles
Browse latest Browse all 587

Jetpack Compose Reducing internal padding of Tabs

$
0
0

I want to reduce padding of a single tab. Following image shows what I want:

1

What I am getting:

2

I am currently using the "accompanist-pager" and "accompanist-pager-indicators" with version 0.16.0.

Code:

@Composablefun Tabs(tabNames: List<String>, pagerState: PagerState, scrollToPage: (Int) -> Unit) {  TabRow(    selectedTabIndex = pagerState.currentPage,    backgroundColor = Color.White,    contentColor = Color.Black,    divider = {      TabRowDefaults.Divider(        thickness = 4.dp      )    },    indicator = { tabPositions ->      TabRowDefaults.Indicator(        modifier = Modifier.customTabIndicatorOffset(tabPositions[pagerState.currentPage]),        height = 4.dp,        color = EmeraldTheme.colors.primary      )    }  ) {    tabNames.forEachIndexed { index, name ->      Tab(        text = {          Text(            text = name,            maxLines = 1,            style = globalSearchDefaultTextStyle,            fontWeight = if (pagerState.currentPage == index) FontWeight.Bold else FontWeight.Normal,            color = if (pagerState.currentPage == index) EmeraldColor.Black100 else colorResource(globalSearchR.color.darkGrey20),          )        },        selected = pagerState.currentPage == index,        onClick = {          scrollToPage(index)        }      )    }    Row { Spacer(Modifier.weight(1f, true)) }  }}

Viewing all articles
Browse latest Browse all 587

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>