Giter VIP home page Giter VIP logo

androidx-auto-scroll-view-pager's Introduction

API GitHub issues Android Arsenal GitHub license androidx

Androidx Auto Scroll ViewPager

  • ViewPager which can auto scrolling, cycling, decelerating.
  • ViewPager which can be slided manually in parent ViewPager.
  • ViewPager which is compatible with AndroidX library.
  • ViewPager which is written in Kotlin and be supported for a long time.

Thanks

Many thanks to Trinea because this library is the newest, kotlin version of his library. We support AndroidX library, so if you have problem when migrating to AndroidX, this version should work like a charm.

Installation

Gradle

Add this to your root build.gradle file under repositories:

allprojects {
	repositories {
		maven { url "https://jitpack.io" }
	}
}

Add this to your app level build.gradle as dependency:

implementation 'com.github.pzienowicz:androidx-auto-scroll-view-pager:{latest.version}'

Latest version:

Usage

  • include this library
  • use below code
<pl.pzienowicz.autoscrollviewpager.AutoScrollViewPager
	android:id="@+id/view_pager"
	android:layout_width="match_parent"
	android:layout_height="wrap_content" />

instead of

<android.support.v4.view.ViewPager
	android:id="@+id/view_pager"
	android:layout_width="match_parent"
	android:layout_height="wrap_content" />

Functions

  • startAutoScroll() start auto scroll, delay time is getInterval().
  • startAutoScroll(int) start auto scroll delayed.
  • stopAutoScroll() stop auto scroll.

Settings

  • setInterval(long) set auto scroll time in milliseconds, default is 1500.
  • setDirection(Direction) set auto scroll direction, default is Direction.RIGHT.
  • setCycle(boolean) set whether automatic cycle when auto scroll reaching the last or first item, default is true.
  • setScrollDurationFactor(double) set the factor by which the duration of sliding animation will change.
  • setSlideBorderMode(SlideBorderMode) set how to process when sliding at the last or first item, default is SlideBorderMode.NONE.
  • setStopScrollWhenTouch(boolean) set whether stop auto scroll when touching, default is true.
  • setBorderAnimation(boolean) set whether animating when auto scroll at the last or first item, default is true.
  • You cannot combine with ViewPagerIndicator if setCycle(true).

Example

Please check example app contained in this repository. This is how it looks like: Example

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.