【问题标题】:Fresco doesn't load images in GridViewFresco 不在 GridView 中加载图像
【发布时间】:2015-12-25 14:22:23
【问题描述】:

这是我在图像适配器中的 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;
}

【问题讨论】:

    标签: android image image-loading fresco


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2018-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多