Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在实时壁纸中创建逐帧动画_Android_Android Canvas_Android Animation_Android Wallpaper - Fatal编程技术网

Android 在实时壁纸中创建逐帧动画

Android 在实时壁纸中创建逐帧动画,android,android-canvas,android-animation,android-wallpaper,Android,Android Canvas,Android Animation,Android Wallpaper,我有一个500帧的动画。我应该为它们创建位图,以便在LiveWallper的画布上显示,但它的性能非常好, 我该怎么做?您可以使用动画列表。例如: <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:dr

我有一个500帧的动画。我应该为它们创建位图,以便在LiveWallper的画布上显示,但它的性能非常好,
我该怎么做?

您可以使用动画列表。例如:

<?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/frame1" android:duration="100" />
    <item android:drawable="@drawable/frame2" android:duration="100" />
    <item android:drawable="@drawable/frame3" android:duration="100" />
    <item android:drawable="@drawable/frame4" android:duration="100" />
    <item android:drawable="@drawable/frame5" android:duration="100" />

......

</animation-list>

......
您可以将此资源与背景视图关联,并在需要启动动画时进行关联


希望它能帮助你

它是否会被设置为背景壁纸并运行24小时?我认为这是一个很好的方法。初始化动画时,应该使用如下内容:ivGif.post(new Runnable(){@Override public void run(){AnimationDrawable frameAnimation=(AnimationDrawable)ivGif.getBackground();frameAnimation.start();frameAnimation.setOneShot(true);} });如何在画布的实时壁纸中使用动画列表?我想让它运行24小时。谢谢你真的需要用帆布吗???如果您需要使用canvas,我记得在canvas中您可以绘制一个可绘制的资源。(动画列表是可绘制的资源)。