GithubHelp home page GithubHelp logo

simpleslider's Introduction

Simple Slider

Maven Central

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

repositories {
  google()
  mavenCentral()
}

dependencies {
    implementation 'io.github.cpacm:simpleslider:2.3.2'
}

Compile with Android 28 and androidx

Add the slider to your layout

<com.cpacm.library.SimpleViewPager
    android:id="@+id/simple_slider"
    android:layout_width="match_parent"
    android:layout_height="140dp">

</com.cpacm.library.SimpleSlider>

Config in your code

    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

两种轮播器,一种是普通模式,一种是回廊模式。

Indicator

indicator

  • CirclePageIndicator
  • IconPageIndicator
  • LinePageIndicator
  • UnderlinePageIndicator

The above indicators modified from ViewPagerIndicator

  • SpringIndicator

Modify from SpringIndicator

多种样式的指示器,可以根据场景选择适合的样式使用。

You can customize the indicator implements PageIndicator

Transform

Transform

The above transforms come from 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 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.

simpleslider's People

Contributors

cpacm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.