** res = animator 中的文件夹.......
翻译动画 xml 文件 = res 文件夹中 animator 文件夹中的 s_in_fleft .....可能有帮助**
public boolean onTouchEvent(MotionEvent touchevent) {
switch (touchevent.getAction()) {
case MotionEvent.ACTION_DOWN: {
lastX = touchevent.getX();
break;
}
case MotionEvent.ACTION_UP: {
float currentX = touchevent.getX();
if (lastX < currentX) {
if (viewFlipper.getDisplayedChild() == 0)
break;
viewFlipper.setInAnimation(this, R.animator.s_in_fleft);
viewFlipper.setOutAnimation(this, R.animator.s_out_right);
viewFlipper.showNext();
}
if (lastX > currentX) {
if (viewFlipper.getDisplayedChild() == 1)
break;
viewFlipper.setInAnimation(this, R.animator.s_in_fright);
viewFlipper.setOutAnimation(this, R.animator.s_out_left);
viewFlipper.showPrevious();
}
break;
}
}
return false;
}