Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cpacm/simpleslider
A simple slider allows you to easily use.
https://github.com/cpacm/simpleslider
android banner indicator simpleslider slider viewpager
Last synced: about 1 month ago
JSON representation
A simple slider allows you to easily use.
- Host: GitHub
- URL: https://github.com/cpacm/simpleslider
- Owner: cpacm
- Created: 2016-03-07T10:44:04.000Z (almost 9 years ago)
- Default Branch: develop
- Last Pushed: 2021-04-12T02:45:54.000Z (over 3 years ago)
- Last Synced: 2024-06-20T15:50:54.547Z (6 months ago)
- Topics: android, banner, indicator, simpleslider, slider, viewpager
- Language: Java
- Homepage:
- Size: 19.8 MB
- Stars: 79
- Watchers: 6
- Forks: 14
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Simple Slider
=====[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.cpacm.simpleslider/simpleslider/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.cpacm.simpleslider/simpleslider)
## Intro
I wrote this library just because I want a lightweight slider.
>Use your own imageloader;
>Create your own indicator;
>Variety of transition effects.这是一款轻量级的图片轮播器,它包括了一下几个特点:
>与图片加载框架完全解耦;
>内置常用的指示器,基本满足对指示器的需求;
>丰富多彩的转场动画,亦可以发挥你的创意创造新的特效;
>内置不同款式的轮播器。
## How to use### Gradle
```groovy
repositories {
google()
mavenCentral()
}dependencies {
implementation 'io.github.cpacm:simpleslider:2.3.2'
}
```
> Compile with Android 28 and androidx
### Add the slider to your layout
```xml```
### Config in your code
```java
simpleSlider.setInfiniteEnable(true);
simpleSlider.startAutoScroll(true);
simpleSlider.setSliderDuration(3000);
simpleSlider.setSliderTransformDuration(DEFAULT_SCROLL_DURATION, new SpringInterpolator());
simpleSlider.setPageTransformer(new ZoomOutSlideTransformer());
circlePageIndicator = (CirclePageIndicator) findViewById(R.id.indicator);
circlePageIndicator.setViewPager(simpleSlider);
//when adapter's data changed, you should call this method
//当adapter数据更新时,必须要调用
simpleSLider.notifyDataSetChanged();
```## Advanced usage
### Basic
![indicator](https://raw.githubusercontent.com/cpacm/SimpleSlider/develop/pic/BasicSlider.gif)两种轮播器,一种是普通模式,一种是回廊模式。
### Indicator
![indicator](https://raw.githubusercontent.com/cpacm/SimpleSlider/develop/pic/IndicatorSlider.gif)
- `CirclePageIndicator`
- `IconPageIndicator`
- `LinePageIndicator`
- `UnderlinePageIndicator`The above indicators modified from [ViewPagerIndicator](https://github.com/JakeWharton/ViewPagerIndicator)
- `SpringIndicator`
Modify from [SpringIndicator](https://github.com/chenupt/SpringIndicator)
多种样式的指示器,可以根据场景选择适合的样式使用。
**You can customize the indicator implements `PageIndicator`**
### Transform
![Transform](https://raw.githubusercontent.com/cpacm/SimpleSlider/develop/pic/TransformSlider.gif)The above transforms come from [AndroidImageSlider](https://github.com/daimajia/AndroidImageSlider)
**You can customize the transform extends `BaseTransformer`**
丰富的过场动画(上面的回廊式轮播就可以通过设置 Transform 来实现)
## **Note:**
无限轮播最低要求有三张页面。**In the infinite loop mode, at least three sliders.**
**Android API >= 3.0**License
---Copyright 2018 cpacm
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 athttp://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.