android支持动态图,GifImageView:可以显示gif动态图的Android ImageView

GifImageView

Android ImageView that handles Animated GIF images

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f416e64726f6964253230417273656e616c2d476966496d616765566965772d627269676874677265656e2e7376673f7374796c653d666c617468747470733a2f2f7472617669732d63692e6f72672f66656c69706563736c2f476966496d616765566965772e7376673f6272616e63683d6d6173746572

Usage

In your build.gradle file:

dependencies {

compile 'com.felipecsl:gifimageview:2.2.0'

}

In your Activity class:

@Override protected void onCreate(final Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

gifView = findViewById(R.id.gifImageView);

gifView.setBytes(bitmapData);

}

@Override protected void onStart() {

super.onStart();

gifView.startAnimation();

}

@Override protected void onStop() {

super.onStop();

gifView.stopAnimation();

}

If you need to post-process the GIF frames, you can do that via GifImageView.setOnFrameAvailable(). You can see an example of that in the sample app included on the repository.

gifImageView.setOnFrameAvailable(new GifImageView.OnFrameAvailable() {

@Override public Bitmap onFrameAvailable(Bitmap bitmap) {

return blurFilter.blur(bitmap);

}

});

You can also reset an animation to play again from the beginning gifImageView.resetAnimation(); or show a specific frame of the animation gifImageView.gotoFrame(3);

Demo

demo.gif

Be sure to also check the demo project for a sample of usage!

Snapshots of the development version are available in Sonatype's snapshots repository.

Contributing

Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

Fork the project

Start a feature/bugfix branch

Commit and push until you are happy with your contribution

Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

Copyright and license

Code and documentation copyright 2011- Felipe Lima. Code released under the MIT license.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值