繁体   English   中英

使用向左/向右拖动可绘制的倒带动画

[英]Rewinding animation drawable using drag left/right

我有可绘制的动画

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
        android:oneshot="true">
    <item            android:duration="70"            android:drawable="@mipmap/scene00089"/>
    <item            android:duration="70"            android:drawable="@mipmap/scene00088"/>
    <item            android:duration="70"            android:drawable="@mipmap/scene00087"/>
    <item            android:duration="70"            android:drawable="@mipmap/scene00086"/>
    //......

只有当我向右(通常运行)或向左(反向)拖动时才应该播放。 我已经实现了如何使用另一个具有反向动画的文件反向播放它,但我需要解决的唯一问题是如何仅在我拖动时播放它并在放下时停止它。

您需要一个视图来播放动画,因此最好在您的布局视图层次结构中创建一个视图并在其上应用动画,如下所示。 希望这会帮助你。

image.setBackgroundResource(R.anim.cubicfacetween);
AnimationDrawable animationDrawable = (AnimationDrawable) image.getBackground();
animationDrawable.start();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM