728x90
val currentVisibleItemPx = dpToPxSize(40)
vpMyRoute.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
outRect.right = currentVisibleItemPx
outRect.left = currentVisibleItemPx
}
})
val nextVisibleItemPx = dpToPxSize(20)
val pageTranslationX = nextVisibleItemPx + currentVisibleItemPx
vpMyRoute.offscreenPageLimit = 1
vpMyRoute.setPageTransformer { page, position ->
page.translationX = -pageTranslationX * (position)
}
'안드로이드' 카테고리의 다른 글
[Android Studio] StatusBar 색상 변경하기 (코틀린) (0) | 2024.03.21 |
---|---|
[Android Studio] ScrollView 방향 확인 법 1. (코틀린) (0) | 2024.03.20 |
[Android Studio] 바텀 네비게이션 뱃지 활용하기 (코틀린) (0) | 2024.01.19 |
[Android Studio] 뷰 화면 캡쳐하기 (코틀린) (0) | 2023.11.14 |
[Android Studio] TextWatcher Utils 로 사용하기 (코틀린) (1) | 2023.11.03 |