We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class HomeBannerAdapter(dataList: ArrayList<BannerData>): BannerAdapter<BannerData, HomeBannerAdapter.BannerViewHolder>(dataList){ inner class BannerViewHolder(var imageView: ImageView): RecyclerView.ViewHolder(imageView) override fun onCreateHolder(parent: ViewGroup?, viewType: Int): BannerViewHolder { val imageView = ImageView(parent?.context) // 必须设置为match_parent,这是ViewPager2强制要求的 imageView.layoutParams = ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, ) imageView.scaleType = ImageView.ScaleType.CENTER_CROP return BannerViewHolder(imageView) } override fun onBindView( holder: BannerViewHolder, data: BannerData, position: Int, size: Int ) { LogUtil.d("HomeBannerAdapter", data.pic) holder.imageView.apply { LogUtil.d("HomeBannerAdapter", data.pic) load(data.pic) // 点击跳转 } } }
banner.apply { setAdapter(mBannerAdapter) indicator = CircleIndicator(context) addBannerLifecycleObserver(viewLifecycleOwner) }
项目一些版本配置如下
compileSdk = "34" targetSdk = "34" minSdk = "29" versionCode = "1" versionName = "1.0" java = "VERSION_17" ksp = "1.9.22-1.0.17" agp = "8.5.1" kotlin = "1.9.22"
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
No branches or pull requests
项目一些版本配置如下
The text was updated successfully, but these errors were encountered: