private void animateHideView(final int position) { final View view = viewList.get(position); // 设置动画Animation集合对像 FlipAnimation rotation = new FlipAnimation(0, 90, 0.0f, view.getHeight() / 2.0f); rotation.setDuration(ANIMATION_DURATION); rotation.setFillAfter(true); rotation.setInterpolator(new AccelerateInterpolator()); rotation.setAnimationListener( new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {} @Override public void onAnimationEnd(Animation animation) { view.clearAnimation(); view.setVisibility(View.INVISIBLE); if (position == viewList.size() - 1) { animatorListener.enableHomeButton(); drawerLayout.closeDrawers(); } } @Override public void onAnimationRepeat(Animation animation) {} }); // 开始动画 view.startAnimation(rotation); }
private void animateView(int position) { final View view = viewList.get(position); view.setVisibility(View.VISIBLE); FlipAnimation rotation = new FlipAnimation(90, 0, 0.0f, view.getHeight() / 2.0f); rotation.setDuration(ANIMATION_DURATION); rotation.setFillAfter(true); rotation.setInterpolator(new AccelerateInterpolator()); rotation.setAnimationListener( new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {} @Override public void onAnimationEnd(Animation animation) { view.clearAnimation(); } @Override public void onAnimationRepeat(Animation animation) {} }); view.startAnimation(rotation); }