支持无限循环的广告栏控件
###Gradle
dependencies {
compile 'com.recker.flybanner:flybanner:1.3'
}
###Usage
Config in xml
<com.recker.flybanner.FlyBanner
android:id="@+id/banner_1"
android:layout_width="match_parent"
android:layout_height="200dp"/>
Config in java
/**
* 加载本地图片
*/
private void initLocalBanner() {
mBannerLocal = (FlyBanner) findViewById(R.id.banner_1);
List<Integer> images = new ArrayList<>();
images.add(R.drawable.img_1);
images.add(R.drawable.img_2);
images.add(R.drawable.img_3);
images.add(R.drawable.img_4);
mBannerLocal.setImages(images);
mBannerLocal.setOnItemClickListener(new FlyBanner.OnItemClickListener() {
@Override
public void onItemClick(int position) {
toast("点击了第"+position+"张图片");
}
});
}
/**
* 加载网页图片
*/
private void initNetBanner() {
mBannerNet = (FlyBanner) findViewById(R.id.banner_2);
List<String> imgesUrl = new ArrayList<>();
for (int i = 0; i < mImagesUrl.length; i++) {
imgesUrl.add(mImagesUrl[i]);
}
mBannerNet.setImagesUrl(imgesUrl);
mBannerNet.setOnItemClickListener(new FlyBanner.OnItemClickListener() {
@Override
public void onItemClick(int position) {
toast("点击了第" + position + "张图片");
}
});
}
###xml参数说明:
参数 | 说明 | 类型 |
---|---|---|
points_visibility | 指示器是否可见 | boolean |
points_position | 指示器位置(左,中,右) | int |
points_container_background | 指示器容器背景 | Drawable |
###方法说明:
方法 | 参数 | 说明 |
---|---|---|
setPointsIsVisible | isVisible | 指示器是否可见 |
setPoinstPosition | position | 指示器位置(左,中, 右) |
###更新说明:
1.3:
1、修复内存溢出问题
1.2:
1、修改一张图片时不轮播
2、新增xml和方法设置指示器,具体看参数说明
1.1:
1、支持轮播网络图片