1M不卡gif图应用

android-gif-drawable : https://github.com/koral–/android-gif-drawable

引用:

 compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
1
直接把布局文件中的 ImageView 替换为 GifImageView

<pl.droidsonroids.gif.GifImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/yiba_location "
    />
 

探寻其他的属性:

GifImageView gifImageView = (GifImageView) findViewById(R.id.gifImageView);

GifDrawable gifDrawable = (GifDrawable) gifImageView.getDrawable();
1
2
3
4
通过 GifImageView 对象获取到 GifDrawable 对象。

gifDrawable.start(); //开始播放

gifDrawable.stop(); //停止播放

gifDrawable.reset();  //复位,重新开始播放

gifDrawable.isRunning(); //是否正在播放

gifDrawable.setLoopCount( 2 ); //设置播放的次数,播放完了就自动停止

gifDrawable.getCurrentLoop(); //获取正在播放的次数

gifDrawable.getCurrentPosition ; //获取现在到从开始播放所经历的时间

gifDrawable.getDuration() ; //获取播放一次所需要的时间
 

1M不卡

猜你喜欢

转载自blog.csdn.net/Lin_XiJun/article/details/84579924