Как обнаружить пролистывание в HorizontalPager в составлении Jetpack? ⇐ Android
-
Anonymous
Как обнаружить пролистывание в HorizontalPager в составлении Jetpack?
How I can detect when user swiped from one tab to second and etc. in my HorizontalPager()?
val pagerState = rememberPagerState(initialPage = 0) HorizontalPager(count = TabCategory.values().size, state = pagerState) { index -> Box( modifier = Modifier .fillMaxSize() .background(MaterialTheme.colors.onBackground) ) { when (TabCategory.values()[index]) { TabCategory.Opinion -> { } TabCategory.Information -> { } TabCategory.Videos -> { } } } }
Источник: https://stackoverflow.com/questions/701 ... ck-compose
How I can detect when user swiped from one tab to second and etc. in my HorizontalPager()?
val pagerState = rememberPagerState(initialPage = 0) HorizontalPager(count = TabCategory.values().size, state = pagerState) { index -> Box( modifier = Modifier .fillMaxSize() .background(MaterialTheme.colors.onBackground) ) { when (TabCategory.values()[index]) { TabCategory.Opinion -> { } TabCategory.Information -> { } TabCategory.Videos -> { } } } }
Источник: https://stackoverflow.com/questions/701 ... ck-compose
Мобильная версия