# CoolViewPager
**Repository Path**: baolong123/CoolViewPager
## Basic Information
- **Project Name**: CoolViewPager
- **Description**: CoolViewPager是一个自定义ViewPager,具有以下功能特征: 支持水平及垂直方向循环滚动 支持自动滚动 支持自动滚动方向、滚动时间、间隔时间的设置 支持调用noti
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: https://www.oschina.net/p/coolviewpager
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 2
- **Created**: 2023-04-19
- **Last Updated**: 2023-04-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
## [README of English](https://github.com/HuanHaiLiuXin/CoolViewPager/blob/master/README.md)
## 关于
[**CoolViewPager**](https://github.com/HuanHaiLiuXin/CoolViewPager)是一个自定义ViewPager,具有以下功能特征:
1. 支持水平及垂直方向循环滚动
2. 支持自动滚动
3. 支持自动滚动方向、滚动时间、间隔时间的设置
4. **支持调用notifyDataSetChanged实时刷新界面**
5. **支持边缘效果颜色的设置**
6. **为垂直滚动提供了适宜的界面切换效果**
## 录屏
| 支持水平及垂直方向循环滚动 |
支持自动滚动及滚动方向、滚动时间、间隔时间的设置 |
 |
 |
| 支持调用notifyDataSetChanged实时刷新界面 |
支持边缘效果颜色的设置 |
 |
 |
| 为垂直滚动提供了适宜的界面切换效果 |
|
 |
|
## Apk
[**demo.apk**](https://github.com/HuanHaiLiuXin/CoolViewPager/blob/master/demo.apk)
## 使用步骤
1 在你的build.gradle中添加依赖
###### JitPack:
- 工程根目录下 build.gradle 中添加
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
- 使用CoolViewPager的模块下 build.gradle 中添加
```
dependencies {
implementation 'com.github.HuanHaiLiuXin:CoolViewPager:v1.0.0'
}
```
###### Bintray:
使用CoolViewPager的模块下 build.gradle 中添加
```
dependencies {
implementation 'com.huanhailiuxin.view:coolviewpager:1.0.0'
}
```
2 在你的布局文件中引入CoolViewPager
```xml
```
3 在你的Java代码中获取CoolViewPager,设置各种属性,为其设置Adapter
```java
public class ActivityEdgeEffectColor extends BaseActivity {
private CoolViewPager vp;
****
CoolViewPager vp = findViewById(R.id.vp);
vp.setScrollMode(CoolViewPager.ScrollMode.HORIZONTAL);
vp.setAdapter(adapter);
****
}
```
## [CoolViewPager的自定义属性](https://github.com/HuanHaiLiuXin/CoolViewPager/blob/master/coolviewpager/src/main/res/values/attrs_coolviewpager.xml)
我们可以通过xml或Java代码的方式设置CoolViewPager实例的属性.
| attribute name | description |
|:---|:---|
| cvp_scrollmode | 滚动方向 |
| cvp_autoscroll | 是否开启自动滚动 |
| cvp_intervalinmillis | 自动滚动时间间隔 |
| cvp_autoscrolldirection | 自动滚动方向 |
| cvp_infiniteloop | 是否循环滚动 |
| cvp_scrollduration | 自动滚动耗时 |
| cvp_drawedgeeffect | 是否绘制边缘效果 |
| cvp_edgeeffectcolor | 绘制的边缘效果颜色 |
#### 在XML中设置
```
```
#### 在Java代码中设置
```java
public class ActivityEdgeEffectColor extends BaseActivity {
private CoolViewPager vp;
private void initViewPager(){
vp = findViewById(R.id.vp);
vp.setScrollMode(CoolViewPager.ScrollMode.VERTICAL);
vp.setAutoScroll(true,1000);
vp.setAutoScrollDirection(CoolViewPager.AutoScrollDirection.BACKWARD);
vp.setInfiniteLoop(true);
vp.setScrollDuration(true,600);
vp.setDrawEdgeEffect(true);
vp.setEdgeEffectColor(getResources().getColor(R.color.colorPrimary));
}
}
```
## 作者
License
=======
Copyright 2018 HuanHaiLiuXin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.