标签:fresco frescogif androidgif android
<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"
android:gravity="center_horizontal"
android:orientation="vertical">
<Button
android:id="@+id/xml_bt_xml_gif"
android:layout_width="match_parent"
android:layout_height="45dp"
android:text="gif播放/暂停"/>
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="350dp"
android:layout_height="300dp"
fresco:placeholderImage="@mipmap/android_icon"
android:id="@+id/xml_gif_iv_show"/>
</LinearLayout>
1.设置
DraweeController
的setAutoPlayAnimations(true)
为true,自动播放
draweeController= Fresco.newDraweeControllerBuilder()
.setAutoPlayAnimations(true)
.setUri(Uri.parse(uri))//设置uri
.build();
//设置Controller
simpleDraweeView.setController(draweeController);
2.控制播放
Animatable animatable=draweeController.getAnimatable();
//判断是否正在运行
if (animatable.isRunning()){
//运行中,停止
animatable.stop();
}else{
//停止了,运行
animatable.start();
}
标签:fresco frescogif androidgif android
原文地址:http://blog.csdn.net/yy1300326388/article/details/45057677