Fresco不会在GridView中加载图像

时间:2015-12-25 14:22:23

标签: android image image-loading fresco

这是我在图像适配器中的getView功能。 GridView似乎是空的。我做错了什么?

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    //ImageView view = (ImageView) convertView;
    DraweeView view = (DraweeView) convertView;
    if (view == null) {
        //view = new ImageView(mContext);
        view = new DraweeView(mContext);
        view.setLayoutParams(new GridView.LayoutParams(200, 200));
        view.setScaleType(ImageView.ScaleType.FIT_CENTER);
        view.setPadding(1, 1, 1, 1);
        view.setBackgroundResource(R.drawable.rounded);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            view.setClipToOutline(true);
        }
    }
    else {
        //view = (ImageView) convertView;
        view = (DraweeView) convertView;
    }
    url = pp[position];
    Uri uri = Uri.parse(url);
    //Picasso.with(mContext).load(url).resize(200, 200).into(view);
    view.setImageURI(uri);

    return view;
}

1 个答案:

答案 0 :(得分:0)

您需要使用SimpleDraweeView,而不是DraweeView。