Android的两个α动画 [英] android two alpha animations

查看:144
本文介绍了Android的两个α动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图把两个字母的动画在一个AnimationSet,如下所示,但是当我运行它,第一个(淡出)的动画时,但它仍然是空白的下一个动画。我知道我可以使用 REPEATMODE =反向来做到这一点,但我想知道这是为什么不在的情况下工作,我希望做一些更花哨。谢谢你。

 <?XML版本=1.0编码=UTF-8&GT?;
    <设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
        <阿尔法
            机器人:时间=1000
            机器人:fillAfter =假
            机器人:fromAlpha =1.0
            机器人:toAlpha =0.0/>
        <阿尔法
            机器人:时间=1000
            机器人:fillBefore =假
            机器人:fillEnabled =真
            机器人:fromAlpha =0.0
            机器人:startOffset =1000
            机器人:toAlpha =1.0/>
    < /集>


解决方案

我遵循同样的thought.And我现在已经测试了这个人来这个职位。
没想到它的工作完美。这里去我的code。

 <阿尔法
        机器人:时间=1000
        机器人:fromAlpha =0.25
        机器人:插值=@机器人:动画/ accelerate_interpolator
        机器人:REPEATMODE =反向
        机器人:startOffset =500
        机器人:toAlpha =1.0/>
    <阿尔法
        机器人:时间=1000
        机器人:fromAlpha =1.0
        机器人:插值=@机器人:动画/ accelerate_interpolator
        机器人:REPEATMODE =反向
        机器人:startOffset =3500
        机器人:toAlpha =0.25/>

第一个将设置阿尔法到一个更高的值,并利用第二阿尔法一段时间后,其拉低。 确保您添加REPEATMODE为反向,即使的repeatCount没有设置,也没有重复发生。并且这种情况发生的实际流量不反转第一α,但切换到反向操作第二阿尔法

I'm trying to put in two alpha animations in one AnimationSet, as follows, but when I run it, the first (fadeout) animation happens, but it remains blank for the next animation. I understand that I can use a repeatMode="reverse" to do this, but I would like to know why this is not working in case I want to do something more fancy. Thanks.

   <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android" >
        <alpha
            android:duration="1000"
            android:fillAfter="false"
            android:fromAlpha="1.0"
            android:toAlpha="0.0" />
        <alpha
            android:duration="1000"
            android:fillBefore="false"
            android:fillEnabled="true"
            android:fromAlpha="0.0"
            android:startOffset="1000"
            android:toAlpha="1.0" />
    </set>

解决方案

I came to this post following the same thought.And i have tested this one now. Unexpectedly its working perfect. Here goes my code.

    <alpha
        android:duration="1000"
        android:fromAlpha="0.25"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:repeatMode="reverse"
        android:startOffset="500"
        android:toAlpha="1.0" />
    <alpha
        android:duration="1000"
        android:fromAlpha="1.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:repeatMode="reverse"
        android:startOffset="3500"
        android:toAlpha="0.25" />

The first one will set alpha to a higher value and its pulled low after some time using a second alpha. Make sure you add "repeatMode" as "reverse" , even though repeatcount is not set and no repeat happens. And the actual flow that happens is not reversing the first alpha , but switching to the second alpha for reverse operation .

这篇关于Android的两个α动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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