CircleIndicator
https://github.com/ongakuer/CircleIndicator
CircleIndicator
A lightweight indicator like in nexus 5 launcher
[Download](https://api.bintray.com/packages/ongakuer/maven/CircleIndicator/images/download.svg)
Gradle
AndroidX
dependencies {
implementation 'me.relex:circleindicator:2.1.0'
}
Android Support Library
dependencies {
compile 'me.relex:circleindicator:1.2.2'
}
Usage
ViewPager
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="48dp"/>
ViewPager viewpager = (ViewPager) view.findViewById(R.id.viewpager);
viewpager.setAdapter(adapter);
CircleIndicator indicator = (CircleIndicator) view.findViewById(R.id.indicator);
indicator.setViewPager(viewpager);
// optional
adapter.registerDataSetObserver(indicator.getDataSetObserver());
RecyclerView
<me.relex.circleindicator.CircleIndicator2
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="48dp"/>
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
pagerSnapHelper.attachToRecyclerView(recyclerView);
CircleIndicator2 indicator = view.findViewById(R.id.indicator);
indicator.attachToRecyclerView(recyclerView, pagerSnapHelper);
// optional
adapter.registerAdapterDataObserver(indicator.getAdapterDataObserver());
Properties:
app:ci_width
app:ci_height
app:ci_margin
app:ci_drawable
app:ci_drawable_unselected
app:ci_animator
app:ci_animator_reverse
app:ci_orientation
(default:horizontal)app:ci_gravity
(default:center)