Aaron Waller
09/01/2022, 3:50 PMAaron Waller
09/01/2022, 3:52 PMval tabList = listOf("Following", "Trending", "New", "Top", "Most Shared", "Most Saved", "All")
val pagerState: PagerState = rememberPagerState(initialPage = 1)
val coroutineScope = rememberCoroutineScope()
Column(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colors.background)
) {
ScrollableTabRow(
modifier = Modifier.fillMaxWidth(),
backgroundColor = MaterialTheme.colors.surface,
contentColor = Color.White,
edgePadding = 8.dp,
selectedTabIndex = pagerState.currentPage,
indicator = { tabPositions ->
TabRowDefaults.Indicator(
Modifier.pagerTabIndicatorOffset(pagerState, tabPositions),
color = MaterialTheme.colors.primary
)
}
) {
// Add tabs for all of our pages
tabList.forEachIndexed { index, title ->
Tab(
text = { Text(title) },
selected = pagerState.currentPage == index,
onClick = {
coroutineScope.launch {
pagerState.animateScrollToPage(index)
}
},
)
}
}
HorizontalPager(
state = pagerState,
count = tabList.size
) { page: Int ->
when (page) {
0 -> MyList()
1 -> MyList()
2 -> MyList()
3 -> MyList()
4 -> MyList()
5 -> MyList()
6 -> MyList()
}
}
MyList:
@Composable
fun MyList(){
LazyVerticalGrid(
modifier = Modifier.fillMaxSize(),
columns = GridCells.Fixed(3),
content = {
items(100) { item ->
Button(onClick = { /*TODO*/ }) {
Text(text = "Hello")
}
}
})
}
Aaron Waller
09/01/2022, 3:57 PMAaron Waller
09/01/2022, 4:13 PMromainguy
09/01/2022, 4:18 PMAaron Waller
09/01/2022, 4:19 PMromainguy
09/01/2022, 4:19 PMromainguy
09/01/2022, 4:20 PMromainguy
09/01/2022, 4:20 PMadb shell cmd package compile -m speed -f my-package
romainguy
09/01/2022, 4:20 PMAaron Waller
09/01/2022, 4:20 PMromainguy
09/01/2022, 4:21 PMAaron Waller
09/01/2022, 4:31 PMromainguy
09/01/2022, 4:59 PMAaron Waller
09/01/2022, 5:01 PMAaron Waller
09/01/2022, 5:04 PMIan G. Clifton
09/01/2022, 7:11 PMBen Trengrove [G]
09/01/2022, 9:59 PMBen Trengrove [G]
09/02/2022, 12:41 AMAaron Waller
09/03/2022, 12:05 PMAaron Waller
09/03/2022, 12:25 PMIan G. Clifton
09/06/2022, 8:28 PMAaron Waller
09/19/2022, 12:23 AMIan G. Clifton
09/19/2022, 10:48 AM