0

我的对话框中有简单的画廊,一切都很好,但是现在当我有一些照片并且我需要滚动查看时,所有过程都无法顺利进行。我读到了使用 Glide lib 的好习惯,所以我尝试使用代码来做到这一点:

Glide.with(mContext)
    .load(listFiles.get(position).toString()) //path to picture
    .into(iv); 

但这对我不起作用。

现在我这样做了,就像我说的那样有效但不顺利

网格视图:

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

        if(convertView == null)
        {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.my_grid, parent, false);
        }

        ImageView iv = (ImageView) convertView.findViewById(R.id.imageView);
    //setting different width and height for different screen sizes
        Bitmap compressed = decodeScaledBitmapFromSdCard(listFiles.get(position).toString(),mContext.
                getResources().getInteger(R.integer.width),mContext.getResources().getInteger(R.integer.height));

        ExifInterface exifInterface=null;
        try {
            exifInterface = new ExifInterface(listFiles.get(position).getAbsolutePath());
        } catch (IOException e) {
            e.printStackTrace();
        }
//rorating bitmap
        Bitmap rotate = delayedMessageService.rotateBitmap(compressed,exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL));
        iv.setImageBitmap(rotate);
        return convertView;
    }

我做错了什么以及它应该如何看待?

4

1 回答 1

2

尝试更换这个

Glide.with(mContext)
    .load(listFiles.get(position).toString()) //path to picture
    .into(iv);

有了这个

Glide.with(mContext)
    .load(listFiles.get(position).getAbsolutePath()) //path to picture
    .into(iv); 
于 2017-05-18T05:43:05.217 回答