Custom view for indicate position.
In your project level build.gradle :
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}In your app level build.gradle :
dependencies {
implementation 'com.github.Seik:ScrollingViewPagerIndicator:{latest_version}'
}In your view:
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<me.ivmg.scrollingviewpagerindicator.ScrollViewPagerIndicator
android:id="@+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:dotSize="16dp"
app:gapSize="3dp"
app:visibleItems="5" />In your code:
final ViewPager viewPager = findViewById(R.id.viewPager);
final ScrollViewPagerIndicator scrollViewPagerIndicator = findViewById(R.id.scrollView);
viewPager.setAdapter(new CustomPagerAdapter(this));
scrollViewPagerIndicator.attachViewPager(viewPager);