0
我有一個非常奇怪的問題,我在處理它的模擬器上運行以下代碼(GenyMotion)。但Nexus 5上運行的代碼提供了跳幀警告。設備跳過框架但不在仿真器中
private void SwipeRight() {
page.setInAnimation(this, android.R.anim.fade_in);
page.setOutAnimation(this, android.R.anim.fade_out);
page.showPrevious();
}
private void SwipeLeft() {
page.setInAnimation(this, android.R.anim.fade_in);
page.setOutAnimation(this, android.R.anim.fade_out);
page.showNext();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
return gestureDetector.onTouchEvent(event);
}
SimpleOnGestureListener simpleOnGestureListener = new SimpleOnGestureListener() {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
float sensitvity = 2900;
if (-velocityX > sensitvity) {
SwipeLeft();
} else if (velocityX > sensitvity) {
SwipeRight();
}
return true;
}
};
GestureDetector gestureDetector = new GestureDetector(
simpleOnGestureListener);
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="100%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="700" />
</set>