Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ongakuer/CircleIndicator
A lightweight indicator like in nexus 5 launcher
https://github.com/ongakuer/CircleIndicator
Last synced: about 2 months ago
JSON representation
A lightweight indicator like in nexus 5 launcher
- Host: GitHub
- URL: https://github.com/ongakuer/CircleIndicator
- Owner: ongakuer
- License: apache-2.0
- Created: 2014-07-30T14:02:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-05-03T11:02:37.000Z (over 1 year ago)
- Last Synced: 2024-10-15T10:06:14.463Z (about 2 months ago)
- Language: Java
- Homepage:
- Size: 4.2 MB
- Stars: 4,266
- Watchers: 93
- Forks: 712
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- -awesome-android-ui - CircleIndicator
- awesome-android-ui - CircleIndicator
- awesome-list - ongakuer/CircleIndicator - A lightweight indicator like in nexus 5 launcher (Java)
- awesome-github-android-ui - CircleIndicator - 轻量级ViewPager指示器 (ViewPager)
- awesome-android-ui - CircleIndicator
- awesome-android-ui - https://github.com/ongakuer/CircleIndicator
- awesome-android-ui - https://github.com/ongakuer/CircleIndicator
README
CircleIndicator
===============
A lightweight indicator like in nexus 5 launcher[ ![Download](https://api.bintray.com/packages/ongakuer/maven/CircleIndicator/images/download.svg) ](https://bintray.com/ongakuer/maven/CircleIndicator/_latestVersion)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.relex/circleindicator/badge.svg)](https://maven-badges.herokuapp.com/maven-central/me.relex/circleindicator)
Gradle
------------##### AndroidX
```groovy
dependencies {
implementation 'me.relex:circleindicator:2.1.6'
}
```##### Android Support Library
```groovy
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)
```java
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)
```java
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)
```java
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
```java
CircleIndicator indicator = view.findViewById(R.id.indicator);
indicator.createIndicators(5,0);indicator.animatePageSelected(2)
```XML Properties
--------```xml
```
| 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 |