android viewpager 滑动

DecentBanner

项目地址: chengdazhi/DecentBanner
简介:An Android Banner that supports auto scrolling and decent animation

sample

To try out the sample, download the apk from chengdazhi.com/decentbanner or scan the following QR code:


Features

  • Smooth buoy movement animation and title opacity animation.

  • You can choose to enable logo at the top left corner.

  • Compatible to banners with less than three items.

  • You can specify the auto scroll interval and animation duration.

  • public methods to start and stop auto scroll.

  • Infinite loop.

Import

Maven

<dependency>
  <groupId>it.chengdazhi.decentbanner</groupId>
  <artifactId>decentbanner</artifactId>
  <version>1.0.7</version>
  <type>pom</type>
</dependency>

Gradle

dependencies {
    compile 'it.chengdazhi.decentbanner:decentbanner:1.0.7'
}

Usage

  • To initiate your DecentBanner, first acquire DecentBanner instance mDecentBanner in Java or XML, then:
/**
* @param views the list of views that you want to include in the banner
* @param titles the list of titles that appears as tabs at the bottom
* @param intervalSeconds the interval of auto scrolling, set to 2 in sample
* @param animationMillis the scrolling's animation time, set to 500 in sample
* @param int logoResourceId | Bitmap logoBitmap the logo you want to display.
        You can skip this param if you don't want it.
*/
mDecentBanner.start(List<View> views, List<String> titles, int intervalSeconds,
        int animationMillis[, int logoResourceId | Bitmap logoBitmap]);
  • Note that when you want to show less than 3 views, you need to extend the views to be no less than three items. When you want to display 2 views, your titles param should contain 2 items and your views param should contain 4 items as ABAB

  • You can call the following two methods to start/stop auto scrolling.

mDecentBanner.startAutoPlay();
mDecentBanner.stopAutoPlay();
  • You can call these method to enable/disable gradient cover or to query whether the cover is enabled
mDecentBanner.setGradientEnabled(boolean enabled);
mDecentBanner.isGradientEnabled();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值