@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (e1.getY() - e2.getY() > FLIP_DISTANCE) {
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
overridePendingTransition(R.anim.anim_come ,R.anim.anim_go);
startActivity(intent);
}
return false;
}
anim_come.xml
<?xml version="1.0" encoding="utf-8"?>
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="-100%p"
android:toYDelta="0" />
anim_go.xml
<?xml version="1.0" encoding="utf-8"?>
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="0"
android:toYDelta="100%p" />
各位版主大神,這樣寫沒有跳轉效果
overridePendingTransition(R.anim.anim_come ,R.anim.anim_go);
startActivity(intent);這兩句位置換一下