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); + } + }