Coder Social home page Coder Social logo

zhouhp007 / bannerview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hudawei996/bannerview

0.0 0.0 0.0 1.09 MB

轮播图控件,支持无限循环轮播,支持三种常用页面特效,支持设置指示器等。满足大部分的项目需求,可以直接使用。

License: Apache License 2.0

Kotlin 100.00%

bannerview's Introduction

BannerView(轮播图控件)

Download

轮播图控件,封装ViewPager,支持无限循环轮播,支持三种常用页面特效,支持设置指示器,支持自动切换手动滑动和自动滑动的滑动时长,封装Banner的Holder实现更加简单。使用Kotlin开发,在项目中使用,满足大部分Banner相关需求,可以直接使用。

本项目基于MZBannerView进行二次开发,只用于开源交流,如果侵权等问题请及时提醒。

使用方法

  1. 在application的build.gradle文件中引入仓库依赖

     dependencies {
          implementation  'com.pingerx:bannerview:1.0.0'
     }
    
  2. 在xml文件中引用BannerView控件

     <com.fungo.banner.BannerView
         android:id="@+id/bannerView"
         android:layout_width="match_parent"
         android:layout_height="200dp"
         app:bannerAutoLoop="true"
         app:bannerPageMode="cover"
         app:bannerPageScale="0.9"
         app:bannerPageAlpha="0.6"
         app:bannerFarMargin="10dp"
         app:bannerCoverMargin="10dp"
         app:bannerPagePadding="20dp"
         app:indicatorVisible="true"
         app:indicatorAlign="right"
         app:indicatorPaddingLeft="12dp"
         app:indicatorPaddingBottom="12dp"
         app:indicatorPaddingRight="12dp"/>
    
  3. 在代码中设置数据和适配器

     bannerView.setPages(data, object : BannerHolderCreator<BannerBean, BannerHolder> {
          override fun onCreateBannerHolder(): BannerHolder {
              return BannerHolder()
          }
      })
    

常用属性

Name Format Description
bannerAutoLoop Boolean 是否开启自动轮播
bannerPageMode Int 页面模式
bannerPageScale Float 左右页面的缩放比例
bannerPageAlpha Float 左右页面的透明度
bannerFarMargin Dimension 远离模式下左右页面的外边距
bannerCoverMargin Dimension 覆盖模式下左右页面的内边距
bannerPagePadding Dimension 中间页面距离左右的距离
indicatorVisible Boolean 指示器是否可见
indicatorAlign Int 指示器的位置
indicatorPaddingLeft Int 指示器距离左侧的距离
indicatorPaddingRight Int 指示器距离右侧的边距
indicatorPaddingTop Int 指示器距离顶部的边距
indicatorPaddingBottom Int 指示器距离底部的边距

参考

bannerview's People

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.