From c7a4c9f501e6e7da9ae3b54586761e05ad2a3706 Mon Sep 17 00:00:00 2001 From: hch <16607480311@163.com> Date: Tue, 26 Mar 2024 17:51:23 +0800 Subject: [PATCH] =?UTF-8?q?add=20[=E6=96=B0=E5=A2=9E-=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5-=E7=82=B9=E5=87=BB=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=B1=95=E7=A4=BA]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/views/UserHomeImgsViewHolder.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/src/main/java/com/yunbao/common/views/UserHomeImgsViewHolder.java b/common/src/main/java/com/yunbao/common/views/UserHomeImgsViewHolder.java index ac03f5365..8b0c8aee9 100644 --- a/common/src/main/java/com/yunbao/common/views/UserHomeImgsViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/UserHomeImgsViewHolder.java @@ -10,8 +10,10 @@ import com.yunbao.common.bean.BannerBean; import com.yunbao.common.glide.ImgLoader; public class UserHomeImgsViewHolder implements BannerViewHolder { + public onCLickListener onCLickListener; @Override + public View createView(Context context, int position, String data) { // 返回mImageView页面布局 ImageView imageView = new ImageView(context); @@ -22,8 +24,24 @@ public class UserHomeImgsViewHolder implements BannerViewHolder { imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); //Glide.with(context).load(data.getImageUrl()).into(imageView); ImgLoader.display(context, data, imageView); + imageView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (onCLickListener != null) { + onCLickListener.OnClick(position); + } + } + }); return imageView; } + public void setOnCLickListener(UserHomeImgsViewHolder.onCLickListener onCLickListener) { + this.onCLickListener = onCLickListener; + } + + public interface onCLickListener { + void OnClick(int position); + } + }