• Stars
    star
    354
  • Rank 120,042 (Top 3 %)
  • Language
    Java
  • Created almost 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

一款简洁实用的android广告栏

一款简洁实用的android广告栏,参考了AndroidImageSliderBGABanner-Android结合自己的理解而成

预览

DownLoad APK

或者扫描二维码下载

Gradle Dependency

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

dependencies {
     compile 'com.github.dongjunkun:BannerLayout:1.0.6'
}

使用

xml

<com.yyydjk.library.BannerLayout
        android:id="@+id/banner"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        app:autoPlayDuration="5000"
        app:indicatorMargin="10dp"
        app:indicatorPosition="rightBottom"
        app:indicatorShape="rect"
        app:indicatorSpace="3dp"
        app:scrollDuration="1100"
        app:selectedIndicatorColor="?attr/colorPrimary"
        app:selectedIndicatorHeight="6dp"
        app:selectedIndicatorWidth="6dp"
        app:unSelectedIndicatorColor="#99ffffff"
        app:unSelectedIndicatorHeight="6dp"
        app:unSelectedIndicatorWidth="6dp" />

代码中使用

//网络地址
bannerLayout.setViewUrls(urls);

//设置加载器
bannerLayout.setImageLoader(new GlideImageLoader());


//添加点击监听
bannerLayout.setOnBannerItemClickListener(new BannerLayout.OnBannerItemClickListener() {
            @Override
            public void onItemClick(int position) {
                Toast.makeText(MainActivity.this, String.valueOf(position), Toast.LENGTH_SHORT).show();
            }
        });

关于我

简书:dongjunkun