2010-07-10 5 views
2

J'essaie de faire glisser les vues Web comme le balayage de vue de liste .... de gauche à droite. J'ai suivi le chemin qui a montré here.ne peut pas glisser webview?

J'ai également mis l'webviews dans le 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> 

mais je pense que la onTouchEvent de webView ne fonctionne pas ici.

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

Répondre

1

Essayez de déplacer vos deux WebViews hors de votre LinearLayout. ViewFlipper bascule entre ses enfants, et avec votre configuration ViewFlipper a un seul enfant. Essayez ceci:

<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> 
Questions connexes