最新的Fresco加载Gif图片

先是依赖

    compile 'com.facebook.fresco:fresco:1.5.0'
    compile 'com.facebook.fresco:animated-gif:1.5.0'

首先需要注册

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Fresco.initialize(this);
    }
}

然后是布局呢


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="bwei.com.tupa.MainActivity">
    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/sdv"
        android:layout_width="150dp"
        android:layout_height="150dp" />
    
        
        
        
LinearLayout>

Activity里的主页面

    private void initView() {
//        mRlv = (RecyclerView) findViewById(R.id.rlv);
        String ss = "http://c.hiphotos.baidu.com/image/w%3D500/sign=64d9fd84bc003af34dbadc60052bc619/37d12f2eb9389b501dc8fddf8f35e5dde7116e03.jpg";
        mSdv = (SimpleDraweeView) findViewById(R.id.sdv);
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setUri(Uri.parse(ss))
                .setAutoPlayAnimations(true)
                .build();
        mSdv.setController(controller);
    }

最新的Fresco加载Gif图片_第1张图片
最新的Fresco加载Gif图片_第2张图片

你可能感兴趣的:(android控件)