回收站中的Imageview [英] Imageview in a recyclerview

查看:88
本文介绍了回收站中的Imageview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在row.xml中有一个imageview,并在xml布局中为其设置了图片.但是当我在适配器中使用它时(onbindviewholder方法)没有显示任何图像.但是,当我在onbindviewholder中设置可以工作并显示图像的图像资源时!!!第一种方法有什么问题?

I have an imageview in row.xml and I set a picture for it in xml layout. But when I use that in adapter (onbindviewholder method) Not show any image . But when I set image resource in onbindviewholder that works and show the image !!! What is wrong in the first method ???

推荐答案

使用

holder.Image.setImageResource();

或者您可以使用Glide或Picasso库加载图像.

or you can use Glide or Picasso library to load images.

,并返回列表的大小.

    @Override
    public int getItemCount() {
        return contacts.size();
    }

这篇关于回收站中的Imageview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆