fresco的使用教程
生活随笔
收集整理的這篇文章主要介紹了
fresco的使用教程
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.加載依賴
api 'org.xutils:xutils:3.5.0'2.創建一個myapplication
public class MyApplication extends Application {@Overridepublic void onCreate() {super.onCreate();Fresco.initialize(this);} }3.網絡權限
<manifest...><uses-permission android:name="android.permission.INTERNET" /><application...android:label="@string/app_name"android:name=".MyApplication">...</application>...</manifest>4.布局的命名空間
<!-- 其他元素--> <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:fresco="http://schemas.android.com/apk/res-auto"android:layout_height="match_parent"android:layout_width="match_parent">5.布局文件
<com.facebook.drawee.view.SimpleDraweeViewandroid:id="@+id/my_image_view"android:layout_width="130dp"android:layout_height="130dp"fresco:placeholderImage="@drawable/my_drawable"/>6.直接使用
Uri uri = Uri.parse("https://raw.githubusercontent.com/facebook/fresco/gh-pages/static/logo.png"); SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view); draweeView.setImageURI(uri);基本直接copy官網的,更多使用看官網
https://www.fresco-cn.org/docs/getting-started.html
轉載于:https://www.cnblogs.com/norm/p/8276275.html
總結
以上是生活随笔為你收集整理的fresco的使用教程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: npm 安装指定的第三方包
- 下一篇: Codeforces Hello 201