开发者

How can I make an image loop infinitely in Android?

开发者 https://www.devze.com 2023-03-10 11:55 出处:网络
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

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

精彩评论

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