add [新增-个人主页-点击图片展示]

This commit is contained in:
hch 2024-03-26 17:51:23 +08:00
parent fe2af299cb
commit c7a4c9f501

View File

@ -10,8 +10,10 @@ import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
public class UserHomeImgsViewHolder implements BannerViewHolder<String> { public class UserHomeImgsViewHolder implements BannerViewHolder<String> {
public onCLickListener onCLickListener;
@Override @Override
public View createView(Context context, int position, String data) { public View createView(Context context, int position, String data) {
// 返回mImageView页面布局 // 返回mImageView页面布局
ImageView imageView = new ImageView(context); ImageView imageView = new ImageView(context);
@ -22,8 +24,24 @@ public class UserHomeImgsViewHolder implements BannerViewHolder<String> {
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
//Glide.with(context).load(data.getImageUrl()).into(imageView); //Glide.with(context).load(data.getImageUrl()).into(imageView);
ImgLoader.display(context, data, 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; return imageView;
} }
public void setOnCLickListener(UserHomeImgsViewHolder.onCLickListener onCLickListener) {
this.onCLickListener = onCLickListener;
}
public interface onCLickListener {
void OnClick(int position);
}
} }