最近做一个动画菜单,为了在动画执行完之后再 offset view ,所以用延迟UI 的方法 。感觉这个这超好用。
Android View 都有一个postDelayed((new Runnable() {}),毫秒数 ) 用于延迟UI操作的方法~
</pre><p></p><p></p><pre name="code" class="java">
private void finishAnim() {
blur_view.setBackgroundColor(Color.BLACK);
AlphaAnimation animationBlurGone;
animationBlurGone = new AlphaAnimation(0.3f, 0f);
animationBlurGone.setDuration(300);
animationBlurGone.setFillAfter(true);
blur_view.setAnimation(animationBlurGone);
Animation mAnimDown = AnimationUtils.loadAnimation(
CalendarActivity.this, R.anim.anim_down);
calendar_view.startAnimation(mAnimDown);
blur_view.postDelayed(new Runnable() {
public void run() {
calendar_view.setVisibility(View.GONE);
CalendarActivity.this.finish();
}
}, 300);
}