开发者

How can I make an image loop infinitely in Android?

I'm hoping this question will be easy to answer, I have 2 pictures of identical shape and size, I'd like them to infinitely loop from one to the other as soon as the app starts. It would be similar to an animated gif, they wouldn't move or rotate, just loop repeatedly开发者_如何学运维, and very vast (over 10 loops per second at least). A way to adjust the speed in milliseconds would be a big plus.


Try to use FrameAnimation. There is example in docs.

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item android:drawable="@drawable/image1" android:duration="200" />
    <item android:drawable="@drawable/image2" android:duration="200" />
</animation-list>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜