I'm trying to get swipe the Web Views like list view swipe.... from left to right. I've followed the way that showed here .
Also I've set the webviews
in the viewflipper
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview1" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview2" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
but I think the onTouchEvent
of webView does not work here.
@Override
public boolean onTouchEvent(MotionEvent event) {
if (gestureDetector.onTouchEvent(event))
return true;
else
return false;
}
Try moving your two WebViews out of your LinearLayout. ViewFlipper switches between its children, and with your setup ViewFlipper has only one child. Try this:
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview1" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview2" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</ViewFlipper>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.