Picasso,fresco的比较

在从网络加载同一张图片,fresco会明显比piacsso快,而且有更好的内存管理,更能也更强大。picasso相对容易上手,操作简单。

picasso使用:到网上去下载一个架包,导入库中,接着使用

Picasso.with(**Activity.this)
                .load( "http://www.clipartbest.com/cliparts/dc6/5br/dc65brxc9.png")
                .fit()
                .into(testImageView);(testIamgeView时图片控件

fresco使用:直接在build.grable添加依赖

compile 'com.facebook.fresco:fresco:0.12.0'
在使用图片的布局里面要添加fresco的图片控件,控件里面可以使用fresco的属性。

Uri uri = Uri.parse("http://www.clipartbest.com/cliparts/dc6/5br/dc65brxc9.png");
        my_image_view.setImageURI(uri);

控件:

<com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/my_image_view"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:scaleType="fitXY"
        fresco:fadeDuration="300" // 淡入淡出的持续时间
        />


fresco常见属性

fresco:fadeDuration="300" // 淡入淡出的持续时间
fresco:actualImageScaleType="focusCrop"  // 实际图像的缩放类型
fresco:placeholderImage="@color/wait_color"  //占位图
fresco:placeholderImageScaleType="fitCenter" //占位图的缩放类型
fresco:failureImage="@drawable/error" //下载失败显示的图片
fresco:failureImageScaleType="centerInside" //失败图的缩放类型
fresco:retryImage="@drawable/retrying"
//图片加载失败时显示,提示用户点击重新加载,重复加载4次还是没有加载出来的时候才会显示failureImage的图片
fresco:retryImageScaleType="centerCrop" //重新加载的图片缩放类型
fresco:progressBarImage="@drawable/progress_bar" //进度条图片
fresco:progressBarImageScaleType="centerInside"
fresco:progressBarAutoRotateInterval="1000"
//进度图自动旋转间隔时间(单位:毫秒ms)
fresco:backgroundImage="@color/blue"
//背景图片,这里的背景图片首先被绘制
fresco:overlayImage="@drawable/watermark"
// 设置叠加图,在xml中只能设置一张叠加图片,如果需要多张图片的话,需要在java代码中设置哦
fresco:pressedStateOverlayImage="@color/red"
// 设置点击状态下的叠加图
fresco:roundAsCircle="false" //设置为圆形图
fresco:roundedCornerRadius="1dp" // 圆角半径
fresco:roundTopLeft="true" // 左上角是否为圆角
fresco:roundTopRight="false"
fresco:roundBottomLeft="false"
fresco:roundBottomRight="true"
fresco:roundWithOverlayColor="@color/corner_color"
fresco:roundingBorderWidth="2dp" //边框的宽度
fresco:roundingBorderColor="@color/border_color" //边框颜色




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值