use*_*798 18 android image-loading picasso
我需要将Sd卡中的图像加载到gridview中.为了提高效率,我正在使用毕加索图书馆
Picasso.with(activity).load(images.get(position).getDataPath())
.resize(96, 96).centerCrop().into(viewHolder.image);
Run Code Online (Sandbox Code Playgroud)
我在适配器中使用了以下代码.很遗憾,我无法看到任何图片,所以请任何人帮忙.
注意 并且任何人都可以建议任何有效的图像加载库来加载SD卡中的图像.
要求 我每次滚动时都不要加载图像.如果已经加载,请不要在滚动时加载图像
Len*_*Bru 47
要加载文件,您需要先将其转换为uri
Uri uri = Uri.fromFile(new File(images.get(position).getDataPath()));
Picasso.with(activity).load(uri)
.resize(96, 96).centerCrop().into(viewHolder.image);
Run Code Online (Sandbox Code Playgroud)
要求我每次滚动时都不要加载图像.如果已经加载,请不要在滚动时加载图像
在Picasso 2.5.2版中,您需要将File作为参数传递给load方法,因此可以将图像加载为:
Picasso.with(context).load(new File(images.get(position).getDataPath()))
.resize(96, 96).centerCrop().into(viewHolder.image);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20156 次 |
| 最近记录: |