如何从SD卡中使用毕加索库中加载图像 [英] How to load image from SD card using Picasso library

查看:199
本文介绍了如何从SD卡中使用毕加索库中加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要加载从SD卡的图像到GridView中。 为了提高效率,我使用的毕加索

  Picasso.with(活动).load(images.get(位置).getDataPath())
            .resize(96,96).centerCrop()成(viewHolder.image)。
 

我用下面的code的适配器。不幸的是中号无法看到任何图片 所以请任何一个可以帮助。

注意 而且还任何人都可以提出任何有效的图像加载库从SD卡装载图像。

要求 我不滚动时每次加载图像。如果已经装上滚动不要加载图像

解决方案

要加载你需要将其转换为一个URI第一文件

 开放的URI = Uri.fromFile(新文件(images.get(位置).getDataPath()));

Picasso.with(活性).load(URI)
            .resize(96,96).centerCrop()成(viewHolder.image)。
 

  

要求我不滚动时每次加载图像。如果它   已经装上滚动不要加载图像

  • 在毕加索是非常适合这种

i need to load images from the Sd card into gridview. For efficiency i'm using Picasso Library

Picasso.with(activity).load(images.get(position).getDataPath())
            .resize(96, 96).centerCrop().into(viewHolder.image);

I used the following code in the adapter. unfortunately m unable to see any images so please can any one help.

Note And also can anyone suggest any efficient image loading library to load the images from the sd card.

Requirement I dont to load the image every time when scrolling. If it is already loaded dont load the image on scrolling

解决方案

To load the file you need to convert it to a uri first

Uri uri = Uri.fromFile(new File(images.get(position).getDataPath()));

Picasso.with(activity).load(uri)
            .resize(96, 96).centerCrop().into(viewHolder.image);

Requirement I dont to load the image every time when scrolling. If it is already loaded dont load the image on scrolling

  • Picasso is excellent for this

这篇关于如何从SD卡中使用毕加索库中加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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