public class BannerView extends RelativeLayout implements BannerAdapter.ViewPagerOnItemClickListener {
@BindView(R.id.layout_banner_viewpager)
ViewPager viewPager;
@BindView(R.id.layout_banner_points_group)
LinearLayout points;
private CompositeSubscription compositeSubscription;
//默认轮播时间,10s
private int delayTime = 10;
private List<ImageView> imageViewList;
private List<BannerEntity> bannerList;
//选中显示Indicator
private int selectRes = R.drawable.shape_dots_select;
//非选中显示Indicator
private int unSelcetRes = R.drawable.shape_dots_default;
//当前页的下标
private int currentPos;
public BannerView(Context context) {
this(context, null);
}
public BannerView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public BannerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(getContext()).inflate(R.layout.layout_custom_banner, this, true);
ButterKnife.bind(this);
imageViewList = new ArrayList<>();
}
/**
* 设置轮播间隔时间
*
* @param time 轮播间隔时间,单位秒
*/
public BannerView delayTime(int time) {
this.delayTime = time;
return this;
}
/**
* 设置Points资源 Res
*
* @param selectRes 选中状态
* @param unselcetRes 非选中状态
*/
public void setPointsRes(int selectRes, int unselcetRes) {
this.selectRes = selec
自定义Banner无限轮播控件
最新推荐文章于 2020-07-03 19:06:28 发布