CircleIndicator

by ongakuer

A lightweight indicator like in nexus 5 launcher

3.8K Stars 697 Forks Last release: about 1 year ago (v2.1.4) Apache License 2.0 111 Commits 6 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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


| Properties | Default Value | | ----------------------------- | ----------------------------- | | app:ciwidth | 5dp | | app:ciheight | 5dp | | app:cimargin | 5dp | | app:cidrawable | R.drawable.whiteradius | | app:cidrawableunselected | R.drawable.whiteradius | | app:cianimator | R.animator.scalewithalpha | | app:cianimatorreverse | 0 | | app:ciorientation | horizontal | | app:ci_gravity | center |

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.