A dot indicator compatible with RecyclerView and ViewPager and ViewPager2.
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.kdu0136:<latest-version>'
}
Add the DotIndicator
to your XML file:
<kim.dongun.dotindicator.DotIndicator
android:id="@+id/dotIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
dotIndicator attachTo recyclerView
dotIndicator attachTo viewPager
dotIndicator attachTo viewPager2
dotIndicator.pageDown()
dotIndicator.pageUp()
Attribute | Note | Default |
---|---|---|
indicatorPadding | Padding start and end | 0dp |
indicatorVisibleDot | Visible dot's count | 5 |
dotSpacing | Spacing between dots | 3dp |
dotSelectSize | Selected dot size | 5dp |
dotLargeSize | Unselect large dot size | 4.5dp |
dotMediumSize | Unselect medium dot size | 3dp |
dotSmallSize | Unselect small dot size | 2dp |
indicatorAnimDuration | Duration of animation in ms | 300 |
indicatorAnimInterpolator | Animation interpolator | decelerate |
dotDefaultColor | Unselected dot color | #E2E2E2 |
dotSelectedColor | Selected dot color | #000000 |