Android是有可能使用并行插值? [英] Android Is it possible to use concurrent interpolators?

查看:147
本文介绍了Android是有可能使用并行插值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组两个动画,无论是动画一起运行使用过冲插

I have a set of two animations, both animations run together using the overshoot interpolator

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@android:anim/overshoot_interpolator" >

    <translate
        android:duration="6000"
        android:fromXDelta="100%" android:toXDelta="0%" />

    <scale
        android:duration="6000"
        android:fromXScale="1.0" android:toXScale="0.6"
        android:pivotX="0"
        android:fromYScale="1.0" android:toYScale="1.0"
        android:repeatCount="1"
        android:repeatMode="reverse" />
</set>

我要的翻译动画过头,而比例动画加速。结果
我试图做到这一点,但它不工作:

I want the translate animation to overshoot, and the scale animation to accelerate.
I tried to do this, but it does not work:

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

    <translate
        android:interpolator="@android:anim/overshoot_interpolator"
        android:duration="6000"
        android:fromXDelta="100%" android:toXDelta="0%" />

    <scale
        android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="6000"
        android:fromXScale="1.0" android:toXScale="0.6"
        android:pivotX="0"
        android:fromYScale="1.0" android:toYScale="1.0"
        android:repeatCount="1"
        android:repeatMode="reverse" />
</set>

看起来好像只有一个内插器可以在给定时间对所有的动画是活性被一个单一的对象上执行。

It seems as if only one interpolator can be active at a given time for all animations being performed on a single object.

推荐答案

这是只能猜测的工作。我记得 AnimationSet 之一的构造函数可以带一个参数,即 shareInterpolator 的。

This is only guess work. I remember that one of AnimationSet's constructors can take an argument, namely shareInterpolator.

通过参数的名称来看,这大概应该是在你的情况下设置为false。现在,它应该是使用默认的价值。此默认值是最有可能的真正的,因为虽然你指定一个不同的针对每个动画不具有不同的插值。

Judging by the name of the parameter, this probably should be set to false in you case. Right now, it should be using the default "value". This default value is most probably true because your animations are not having different interpolators although you specified a different one for each.

要确认,AnimationSet源$ C ​​$ C具有以下行指定为shareInterpolator一个值(XML):

To confirm, the source code of AnimationSet has the following line to assign a value for shareInterpolator (from xml):

setFlag(PROPERTY_SHARE_INTERPOLATOR_MASK, 
        a.getBoolean(com.android.internal.R.styleable.AnimationSet_shareInterpolator
             , true));

这显然意味着,如果没有指定这个布尔变量,则默认为真。

This clearly means that if this boolean is not specified, it will default to true.

解决方案

要解决您的问题,我想你应该利用这个R.styleable.AnimationSet_shareInterpolator指定。这仅仅意味着 添加 的android:shareInterpolator =FALSE 你的&LT;集&gt; 元素

To fix your problem, I suppose you should specify it using this "R.styleable.AnimationSet_shareInterpolator". This merely means adding android:shareInterpolator="false" to your <set> elements

这篇关于Android是有可能使用并行插值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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