Gra*_*tzi 34 android android-animation
我希望有一个View最初是不可见的,当我按下一个按钮时,它会以淡入淡出的动画显示出来.我正在使用AlphaAnimation褪色效果.问题是,如果我使视图不可见,则无法看到动画.
非常感谢,
的Gratzi
Tan*_*dal 126
假设res\anim \文件夹中有一个ImageView命名imageView文件和一个动画文件your_fade_in_anim.xml:
ImageView imageView = (ImageView) findViewById(R.id.imageView);
Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.your_fade_in_anim);
// Now Set your animation
imageView.startAnimation(fadeInAnimation);
Run Code Online (Sandbox Code Playgroud)
你的XML
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="[duration (in milliseconds)]"
android:repeatCount="infinite" />
</set>
Run Code Online (Sandbox Code Playgroud)
用实际持续时间替换括号.
Tim*_*Ohr 26
提供AnimationListener动画并在动画开始后立即显示视图.
http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html
| 归档时间: |
|
| 查看次数: |
64697 次 |
| 最近记录: |