Jam*_*mie 3 android android-animation
我有这个动画应该将应用的视图移出视图,同时褪色,将其移回视图下方,然后在褪色时返回视图.
问题是它似乎没有消失 - 应用视图的不透明度总是如此0.5.
<?xml version="1.0" encoding="UTF-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="0"
android:toYDelta="-200"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="1995"
android:startOffset="3000" />
<translate
android:fromYDelta="200"
android:toYDelta="0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="1995"
android:startOffset="8005" />
<alpha
android:duration="500"
android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatMode="reverse"
android:startOffset="3000"
android:toAlpha="0.5" />
<alpha
android:duration="1995"
android:fromAlpha="0.5"
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatMode="reverse"
android:startOffset="8005"
android:toAlpha="1.0" />
</set>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了很多东西,将它们嵌套在一起,删除内插器等......唯一有用的是使用这个SO问题中给出的例子:android两个alpha动画让我相信它与之相关与翻译动画结合使用时运行alpha动画.
谢谢!
这是一个例子:
AnimationSet set = new AnimationSet(true);
Animation trAnimation = new TranslateAnimation(0, 500, 0, 0);
trAnimation.setDuration(6000);
trAnimation.setRepeatMode(Animation.REVERSE); // This will make the view translate in the reverse direction
set.addAnimation(trAnimation);
Animation anim = new AlphaAnimation(1.0f, 0.0f);
anim.setDuration(3000);
set.addAnimation(anim);
txtView.startAnimation(set); // replace this with your view
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11764 次 |
| 最近记录: |