This is Pager using ScrollView.
It works like ViewPager, but it works vertically.
- You should implement in your project.
- in your settings.gradle
allprojects { repositories { ... maven { url 'https://jitpack.io' } } } - in your build.gradle (app level)
dependencies { implementation 'com.github.djawnstj:ScrollPager:1.1.0' }
- in your settings.gradle
- add layout xml like...
<com.github.djawnstj.VerticalScrollPager android:id="@+id/scrollPager" android:layout_width="match_parent" android:layout_height="match_parent"> </com.github.djawnstj.VerticalScrollPager>
- add child view
- in xml
<com.github.djawnstj.VerticalScrollPager android:id="@+id/scrollPager" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/imageView" android:layout_width="match_parent" android:layout_height="match_parent"/> ... </com.github.djawnstj.VerticalScrollPager>
- in kotlin
val scrollPager = findViewById<VerticalScrollPager>(R.id.scrollPager) val imageView = ImageView(this) scrollPager.addView(imageView)
- in xml
- Call a scroll function when you want to.
binding.scrollPager.scrollToView(binding.imageView)
1.1.0:- You no longer need to add top-level layouts.
- Force to change the size of child view (match_parent)
1.0.2: Troubleshooting library implementation
