Is it possible to set an animated gif file as background of my app in android?

◇◆丶佛笑我妖孽 提交于 2019-12-01 01:59:16

Yes, you can set the gif image but this will not animate your gif image. You need to explicitly extract the gif image into all frame and then using animate you image as gif here is the example of

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >

    <item
        android:drawable="@drawable/framelayout1"
        android:duration="1000"/>

    <item
        android:drawable="@drawable/framelayout2"
        android:duration="1000"/>

    <item
        android:drawable="@drawable/framelayout3"
        android:duration="1000"/>

    <item
        android:drawable="@drawable/framelayout4"
        android:duration="1000"/>

    ....

</animation-list>
Vaiden

Why should this be different from using animated Gifs anywhere else on Android? The answer is - it's exactly the same.

Here is how to display animated gifs on Android: Display Animated GIF

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!