Tin Tran
08/02/2021, 10:43 AMHorizontalPager
. If each page have difference height then the HorizontalPager
will match the size of the largest page is that correct?Tin Tran
08/02/2021, 10:50 AM@ExperimentalPagerApi
@Preview
@Composable
fun test() {
val pageList = listOf(1, 10, 4)
Column(
Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
) {
Box(
modifier = Modifier
.height(200.dp)
.fillMaxWidth()
.background(Color.Green)
)
HorizontalPager(state = rememberPagerState(pageCount = 3)) { page ->
Column {
repeat(pageList[page]) {
Box(
modifier = Modifier
.height(50.dp)
.fillMaxWidth()
.background(Color.Red)
)
Spacer(modifier = Modifier.height(20.dp))
}
}
}
Box(
modifier = Modifier
.height(50.dp)
.fillMaxWidth()
.background(Color.Yellow)
)
}
}
Tin Tran
08/02/2021, 10:50 AMTin Tran
08/02/2021, 10:52 AM