Fresco图片框架初始化介绍

之前项目里面一直使用ImageLoder,现在想换个 图片加载框架,看到大家提到的最多的Fresco框架很好用, Fresco是facebook推出的一款强大的图片加载的框架。

1:由于我的开发工具是studio,所以需要在gradle中配置一下

compile 'com.facebook.fresco:fresco:0.10.0+'

2:同时需要在Application中初始化一下

Fresco.initialize(context); 

3:加载网络图片时还需要有网络权限。

<uses-permission android:name="android.permission.INTERNET"/>  

4:布局文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    xmlns:fresco="http://schemas.android.com/apk/res-auto"  
    android:layout_width="match_parent"  
    android:layout_height="match_parent">  
  
    <com.facebook.drawee.view.SimpleDraweeView  
        android:id="@+id/image_view"  
        android:layout_width="300dp"  
        android:layout_height="300dp"  
        fresco:placeholderImage="@mipmap/ic_launcher"/>  
  
</LinearLayout> 

5:开始使用

SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.image_view);
Uri uri = Uri.parse("图片的网络地址");  
imageView.setImageURI(uri); 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值