0
當我使用縮放縮放手勢時,以水平方式,當按下的座標和釋放的座標達到一定的差值時,滑動功能總是被調用。如何在不調用webview中的滑動功能的情況下使用縮放縮放?
我該如何解決這個問題?
這是對的WebView
view.getSettings().setBuiltInZoomControls(true);
view.getSettings().setSupportZoom(true);
view.getSettings().setDisplayZoomControls(false);
的刷卡功能
protected void swipePage(View v, MotionEvent event, int book) {
int action = MotionEventCompat.getActionMasked(event);
switch (action) {
case (MotionEvent.ACTION_DOWN):
swipeOriginX = event.getX();
swipeOriginY = event.getY();
break;
case (MotionEvent.ACTION_UP):
int quarterWidth = (int) (screenWidth * 0.3);
float diffX = swipeOriginX - event.getX();
float diffY = swipeOriginY - event.getY();
float absDiffX = Math.abs(diffX);
float absDiffY = Math.abs(diffY);
if ((diffX > quarterWidth) && (absDiffX > absDiffY)) {
try {
navigator.goToNextChapter(index);
} catch (Exception e) {
errorMessage(getString(R.string.error_cannotTurnPage));
}
} else if ((diffX < -quarterWidth) && (absDiffX > absDiffY)) {
try {
navigator.goToPrevChapter(index);
} catch (Exception e) {
errorMessage(getString(R.string.error_cannotTurnPage));
}
}
break;
}
}
它不工作..我使用內置的代碼爲WebView捏縮放。我在我的WebView的設置中啓用了縮放縮放功能。 – Cedu 2014-10-13 08:02:24