Android 動畫監聽器ide
- public class HomeAnimationListener implements AnimationListener {
- /**
- * left or rigth
- */
- private int flag;
- private ViewGroup animView;
- public HomeAnimationListener(int flag, ViewGroup view) {
- this.flag = flag;
- this.animView = view;
- }
- @Override
- public void onAnimationStart(Animation animation) {
- }
- @Override
- public void onAnimationEnd(Animation animation) {
- animView.clearAnimation();
- switch (flag) {
- case -1:
- animView.layout(0, 0, Variable.availableWidth,
- Variable.availableHeight);
- break;
- case 1:
- animView.layout((int) (Variable.availableWidth * Common.USERPART),
- 0, (int) (Variable.availableWidth * (1 + Common.USERPART)),
- Variable.availableHeight);
- break;
- default:
- break;
- }
- animView.postInvalidate();
- }
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
- }