Implementation of a ViewPager that supports both vertical and horizontal swiping.
arkon 7168aff0a0 Create LICENSE | 3 years ago | |
---|---|---|
demo | 3 years ago | |
gradle | 3 years ago | |
library | 3 years ago | |
.gitignore | 6 years ago | |
LICENSE | 3 years ago | |
README.md | 3 years ago | |
build.gradle | 3 years ago | |
gradle.properties | 3 years ago | |
gradlew | 6 years ago | |
gradlew.bat | 6 years ago | |
settings.gradle | 6 years ago |
Implementation of a ViewPager that supports both vertical and horizontal swiping. It's based on the support library 27.1.1 and uses the same package as ViewPager in order to use its interfaces and make it compatible with adapters and listeners.
A pager can be instantiated either from XML, optionally providing android:orientation
:
<androidx.viewpager.widget.DirectionalViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
Or from code:
val pager = DirectionalViewPager(context, false) // or true for horizontal
The direction of the pager can be changed at runtime with:
pager.setHorizontal(!pager.isHorizontal());