动画的顺序播放
16lz
2021-01-23
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="800" android:fromYDelta="-100%" android:toYDelta="0" /> <translate android:duration="800" android:fromYDelta="0" android:startOffset="1800" android:toYDelta="-100%" /></set>
参数: startOffset表示,该动画延迟多长时间开始播放。 这样就能变现满足动画顺序播放的效果。
public void popInfo() { Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.custom_home_text_info); textInfo.setVisibility(View.VISIBLE); //在播放动画之前, 要让该控件先显示出来, 否则有bug。 anim.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { textInfo.setVisibility(View.GONE); } }); textInfo.startAnimation(anim); }
更多相关文章
- Android显示GIF动画完整示例(二)
- 控件布局_TableLayout
- Android 日历方式显示的日期选择组件(日历控件之一)
- 控件的圆角
- Android 用属性动画自定义view的渐变背景
- android获取控件宽度
- Android 自定义控件之ViewPager Indicator实现方式
- android 属性动画之 ObjectAnimator