Skip to content
A lightweight indicator like in nexus 5 launcher
Java
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Support ViewPager2 May 24, 2019
LoopingViewPager update Aug 14, 2019
apk Update Sample Apk May 24, 2019
circleindicator update Aug 14, 2019
gradle/wrapper Update dependencies May 24, 2019
sample update Aug 14, 2019
.gitignore Support RecyclerView Oct 13, 2018
CHANGELOG.md Update May 24, 2019
CircleIndicator.iml Support ViewPager2 May 24, 2019
LICENSE Create LICENSE Jul 23, 2018
README.md Update README.md Aug 8, 2019
build.gradle Manual control. Add Loop RecyclerView Sample Jul 31, 2019
gradle.properties Manual control. Add Loop RecyclerView Sample Jul 31, 2019
gradlew change package Jul 30, 2014
gradlew.bat change package Jul 30, 2014
screenshot.gif update screenshot Aug 1, 2014
settings.gradle Release Version 1.1.9 Apr 16, 2016

README.md

CircleIndicator

A lightweight indicator like in nexus 5 launcher

Download

Gradle

AndroidX
dependencies {
    implementation 'me.relex:circleindicator:2.1.4'
}
Android Support Library
dependencies {
    implementation 'me.relex:circleindicator:1.3.2'
}

Usage

Class Widget
me.relex.circleindicator.CircleIndicator ViewPager
me.relex.circleindicator.CircleIndicator2 RecyclerView
me.relex.circleindicator.CircleIndicator3 ViewPager2 (AndroidX)
ViewPager (CircleIndicator)
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 (CircleIndicator2)
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());
ViewPager2 (CircleIndicator3)
ViewPager2 viewpager = view.findViewById(R.id.viewpager);
viewpager.setAdapter(mAdapter);

CircleIndicator3 indicator = view.findViewById(R.id.indicator);
indicator.setViewPager(viewpager);

// optional
adapter.registerAdapterDataObserver(indicator.getAdapterDataObserver());
Manual control
CircleIndicator indicator = view.findViewById(R.id.indicator);
indicator.createIndicators(5,0);

indicator.animatePageSelected(2)

XML Properties

<me.relex.circleindicator.CircleIndicator
	android:id="@+id/indicator"
	android:layout_width="match_parent"
	android:layout_height="48dp"/>
Properties Default Value
app:ci_width 5dp
app:ci_height 5dp
app:ci_margin 5dp
app:ci_drawable R.drawable.white_radius
app:ci_drawable_unselected R.drawable.white_radius
app:ci_animator R.animator.scale_with_alpha
app:ci_animator_reverse 0
app:ci_orientation horizontal
app:ci_gravity center
You can’t perform that action at this time.