android;在AdapterViewFlipper上设置动画的输入/输出:未知的动画师名称翻译 [英] android; setting in/out animations on AdapterViewFlipper: Unknown animator name translate

查看:292
本文介绍了android;在AdapterViewFlipper上设置动画的输入/输出:未知的动画师名称翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些非常简单的动画,可以很好地与ViewFlipper一起使用,但是如果尝试在AdapterViewFlipper上输入/输出上设置它们,则会收到运行时错误未知的动画师名称翻译。在查看每个方法的各个方法时,ViewFlipper期望使用ViewAnimation,而AdapterViewFlipper期望使用AdapterViewAnimation。否则,其他API都是相同的,并且两者的构建都没有错误。这是其中一个动画的xml:

 <?xml version = 1.0 encoding = utf-8? > 
< set xmlns:android = http://schemas.android.com/apk/res/android
android:shareInterpolator = false>

<翻译
android:fromXDelta = 0% android:toXDelta =-100%
android:fromYDelta = 0% android:toYDelta = 0 %
android:duration = 800 />
< / set>

我将它放在脚蹼上,如:

  vf.setOutAnimation(this,R.anim.out_to_left); 

我猜这可能意味着我不能使用翻译,输入,但是我将如何使用完成相同的动画? me脚...

解决方案

在这里找到答案:https://stackoverflow.com/a/26197426/1534666



看来,ViewFlipperAdapter需要一个objectAnimator,而不是set。 / p>

在动画器文件夹中声明的示例left_in.xml

 < objectAnimator xmlns:android = http://schemas.android.com/apk/res/android 
android:interpolator = @ android:anim / accelerate_decelerate_interpolator
android:propertyName = x
android:valueType = floatType
android:valueFrom =-1500
android:valueTo = 0
android:duration = 600 />


I have some very simple animations that work perfectly with a ViewFlipper, but if I try setting them on an AdapterViewFlipper in/out, I get a runtime error "Unknown animator name translate". In looking at the respective methods on each, it looks like ViewFlipper expects a ViewAnimation, and AdapterViewFlipper expects an AdapterViewAnimation. The api's are otherwise the same, and both build without error. Here's the xml for one of the animations:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shareInterpolator="false">

    <translate
    android:fromXDelta="0%" android:toXDelta="-100%"
    android:fromYDelta="0%" android:toYDelta="0%"
    android:duration="800"/>
</set>

and I set it on the flipper like:

vf.setOutAnimation(this, R.anim.out_to_left);

I can guess this might mean that I can't use translate, type, but then how would I accomplish the same animation? Lame...

解决方案

Found the answer here: https://stackoverflow.com/a/26197426/1534666

It appears that a ViewFlipperAdapter needs a objectAnimator, not a set.

Example left_in.xml, declared in animator folder

<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
            android:interpolator="@android:anim/accelerate_decelerate_interpolator"
            android:propertyName="x"
            android:valueType="floatType"
            android:valueFrom="-1500"
            android:valueTo="0"
            android:duration="600"/>

这篇关于android;在AdapterViewFlipper上设置动画的输入/输出:未知的动画师名称翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆