Skip to content

Android Kotlin基于ViewPage2和ViewBinding的轻量级BannerView轮播图;简洁、高效、功能强大,一行代码轻松实现循环轮播,一屏三页任意变,Item样式任意定制扩展

License

Notifications You must be signed in to change notification settings

zhzc0x/banner-android

Repository files navigation

BannerView-Android

Android Kotlin基于ViewPage2和ViewBinding的轻量级BannerView,功能全面,易定制扩展

Demo效果图

使用

  • 添加gradle依赖(version=

    //Add it in your root build.gradle at the end of repositories:
    allprojects {
      repositories {
      	...
    		maven { url 'https://jitpack.io' }
    	}
    }
    
    //Add it in your app build.gradle
    dependencies {
        implementation 'com.github.zhzc0x:banner-android:$version'
    }
  • 布局文件中声明(更多属性说明详见 #自定义属性说明)

    <com.zhzc0x.banner.BannerView
            android:id="@+id/bannerView1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:autoplay="true"
            app:loopPlay="true"
            app:displayTextBackground="#4D000000"
            app:displayTextColor="@color/white"
            app:displayTextGravity="left"
            app:displayTextSize="16sp"
            app:displayTextStyle="bold"
            app:indicatorGravity="bottom|right"
            app:isNumberIndicator="false"
            app:layout_constraintBottom_toTopOf="@+id/bannerView2"
            app:layout_constraintTop_toTopOf="parent" /> 
  • 代码调用(Kotlin)