网站首页  软件下载  游戏下载  源码下载  词典软件  教程攻略

请输入您要查询的软件:

 

软件 picasso-2.5.2.jar包(安卓图片加载框架) 官方免费版
图标
分类 软件下载-应用软件-编程开发-java相关-picasso.jar下载 java相关
语言 简体中文
大小 107KB
软件类型 国产软件
发布时间
用户评分 3
备案号
官方网址
软件授权 免费软件
操作系统 Windows平台
厂商
下载
介绍

picasso是Square公司开源的一个安卓图片加载框架,可以实现图片下载和缓存功能。picasso解决了adapter加载不在视野范围的ImageView图片资源导致图片错位的错误,同时它使用了复杂的图片压缩转换来尽可能的减少内存消耗,并自带内存和硬盘二级缓存功能,如果您开发安卓应用需要用到图片加载库的话,picasso就是不错的选择。

功能特点:

1.ImageView在适配器中处理回收和下载取消。

2.复杂的图像转换与最小的内存使用。

3.自动内存和磁盘缓存。

使用方法:

适配器下载

自动检测适配器重新使用,并取消以前的下载。

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

SquaredImageView view =(SquaredImageView)convertView;

if(view == null){

view = new SquaredImageView(context);

}

String url = getItem(position);

Picasso.with(context).load(url).into(view);

}

图像转换

转换图像以更好地适应布局并减少内存大小。

Picasso.with(context)

.load(url)

.resize(50,50)

.centerCrop()

.into(imageView)

您还可以为更高级的效果指定自定义转换。

public class CropSquareTransformation implements Transformation {

@Override public Bitmap transform(Bitmap source){

int size = Math.min(source.getWidth(),source.getHeight());

int x =(source.getWidth() - size)/ 2;

int y =(source.getHeight() - size)/ 2;

Bitmap result = Bitmap.createBitmap(source,x,y,size,size);

if(result!= source){

source.recycle();

}

return result;

}

@Override public String key(){return“square()”; }

}

将此类的实例传递给该transform方法。

Place Holders

Picasso.with(context)

.load(url)

.placeholder(R.drawable.user_placeholder)

.error(R.drawable.user_placeholder_error)

 

.into(imageView);

在显示错误占位符之前,将重试三次请求。

资源加载

资源,资产,文件,内容提供程序都作为图像来源被支持。

Picasso.with(context).load(R.drawable.landing_screen).into(imageView1);

Picasso.with(context).load(“file:///android_asset/DvpvklR.png”).into(imageView2);

Picasso.with(context).load(new File(...))。into(imageView3);

Debug Indicators

对于开发,您可以启用指示图像源的彩**带的显示。调用setIndicatorsEnabled(true)毕加索实例。

截图
随便看

 

网盟-旗舰软件下载站,将绿色免费商业版破解软件、共享软件、游戏、电影、电视剧一网打尽!

 

Copyright © 2002-2024 cnnbu.com All Rights Reserved
更新时间:2025/4/7 11:03:13