https://github.com/stars-one/circlepointmove
A simple ViewPager circle point indicator which can move together with Viewpager,一个简单的Viewpager圆点指示器,可随Viewpager/Viewpaper2移动
https://github.com/stars-one/circlepointmove
Last synced: 6 months ago
JSON representation
A simple ViewPager circle point indicator which can move together with Viewpager,一个简单的Viewpager圆点指示器,可随Viewpager/Viewpaper2移动
- Host: GitHub
- URL: https://github.com/stars-one/circlepointmove
- Owner: stars-one
- Created: 2018-02-07T16:13:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-28T10:17:36.000Z (about 1 year ago)
- Last Synced: 2025-03-25T08:11:40.314Z (7 months ago)
- Language: Kotlin
- Homepage: http://www.cnblogs.com/kexing/p/8433289.html
- Size: 435 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CirclePointMove
A simple ViewPager indicator.What can it do?Well,it can let the circle point move together with the move of viewpager move(support ViewPaper and ViewPaper2)
一个简单的Viewpager指示器,它能实现什么?它能使圆点跟随ViewPager移动(兼容Viewpager和Viewpager2)
- [新中文文档](https://github.com/stars-one/CirclePointMove/blob/master/README_zh.md)
- [中文文档](http://www.cnblogs.com/kexing/p/8433289.html)
## Picture
## Usage
1.Add the JitPack repository to your build file```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```2.Add the dependency
```
dependencies {
implementation 'com.github.Stars-One:CirclePointMove:2.1'
}
```3.Add CirclePointMove to layout xml file
```xml```
4. setup the circle point in your viewpaper or viewpaper2
```kotlin
val mCirclepoint = findViewById(R.id.circlepoint) as CirclePoint//call the extend method of ViewPager or ViewPager which named 'setupCirclePoint'
mViewpager.setupCirclePoint(mCirclepoint)//note the second param ,it is the same as the page count of your viewpaper2
vp2.setupCirclePoint(mCirclepoint2,6)
```**Old way:**
```kotlin
//Old way For ViewPager
val mCirclepoint = findViewById(R.id.circlepoint) as CirclePointmViewpager.addOnPageChangeListener(object : OnPageChangeListener {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
//note this
mCirclepoint.setonPageScrolled(position, positionOffset, positionOffsetPixels)
}override fun onPageSelected(position: Int) {}
override fun onPageScrollStateChanged(state: Int) {}
})//Old way For ViewPager2:
val mCirclepoint = findViewById(R.id.circlepoint) as CirclePointvp2.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
//note this
mCirclepoint.setonPageScrolled(position, positionOffset, positionOffsetPixels)
}
})
```## view properties
|property |description |default|
|-- |-- |-- |
|size |the size of showing circle point |8dp |
|point_unselected_color |the color of unselected circle point |0 |
|point_selected_color |the color of selected circle |0 |
|cout |the item of your viewpager |3 |