android kotlin 上的滑块横幅,照片占屏幕的 100%
slider banner on android kotlin with photos 100% of the screen
android kotlin 上的滑块横幅我发现的只是 detectDragGestures 有没有人有更好的建议?
带照片的滑块横幅 100% 的移动 phone 屏幕
您可以使用 Pager from the accompanist library.
你只需要添加依赖:
dependencies {
implementation "com.google.accompanist:accompanist-pager:0.8.1"
}
然后如下使用:
@ExperimentalPagerApi
@Composable
fun ViewPagerScreen() {
val images = listOf(
R.drawable.image1,
// include the other images here...
)
HorizontalPager(
state = rememberPagerState(pageCount = images.size),
offscreenLimit = 2
) { page ->
Image(
painterResource(id = images[page]),
null,
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop
)
}
}
android kotlin 上的滑块横幅我发现的只是 detectDragGestures 有没有人有更好的建议?
带照片的滑块横幅 100% 的移动 phone 屏幕
您可以使用 Pager from the accompanist library.
你只需要添加依赖:
dependencies {
implementation "com.google.accompanist:accompanist-pager:0.8.1"
}
然后如下使用:
@ExperimentalPagerApi
@Composable
fun ViewPagerScreen() {
val images = listOf(
R.drawable.image1,
// include the other images here...
)
HorizontalPager(
state = rememberPagerState(pageCount = images.size),
offscreenLimit = 2
) { page ->
Image(
painterResource(id = images[page]),
null,
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop
)
}
}