布局文件,不用写viewpager
【轮播图|轮播图,支持自定义小点】
implementation 'com.bigkoo:convenientbanner:2.1.5'
indicator.setPages(object : CBViewHolderCreator {
override fun createHolder(itemView: View?): Holder<*> {
return object : Holder(itemView) {
override fun updateUI(data: DataBean?) {
(itemView as ImageView).setImageResource(R.drawable.nbanner_sy);
}override fun initView(itemView: View?) {
(itemView as ImageView).scaleType=ImageView.ScaleType.FIT_XY
}
}}override fun getLayoutId(): Int {
return R.layout.item_binner
}}, datas)
.setPageIndicator(intArrayOf(R.drawable.ic_unselect_gray_point, R.drawable.ic_select_red_point))
.setOnItemClickListener(
object : OnItemClickListener {
override fun onItemClick(position: Int) {}})