2010-07-10 4 views
2

Я пытаюсь получить салфетки в виде веб-страниц, как показано на экране списка ... слева направо. Я следил за тем, как показал here.не удается просмотреть веб-просмотр?

Также я установить webviews в 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> 

, но я думаю, что onTouchEvent из WebView здесь не работает.

@Override 
    public boolean onTouchEvent(MotionEvent event) { 
     if (gestureDetector.onTouchEvent(event)) 
      return true; 
     else 
      return false; 
    } 

ответ

1

Попробуйте переместить два WebViews из LinearLayout. ViewFlipper переключает между своими дочерними элементами, и с вашей установкой 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"> 
    <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>