WebView horizontales scrollen ausfällt

Ich habe ein seltsames Problem mit einem WebView innerhalb einer fragment. Das horizontale scrollen funktioniert nicht richtig. Es scrollt nur ein bisschen. Es ist kein problem, scrollen die Inhalte vertikal, pinch to zoom, und ja, das verschieben der Seite mit zwei Fingern, während kneifen funktioniert auch in alle Richtungen.

Dies ist die onCreateView()-Methode des Fragments, welche die WebView. Ich kann nicht mit WebViewFragment.
Dieses Fragment ist in einem Viewpager! Die zur Verfügung gestellten Daten ist eine gültige html5-Dokument. Aber ich habe nicht erfolgreich versucht, eine "echte Webseite", wie gut.

this.mView = inflater.inflate(R.layout.search_results, container, false);
        mWebView = (WebView)this.mView.findViewById(R.id.search_results);
        mWebView.setWebViewClient(new SearchResultsWebViewClient());
        mWebView.setInitialScale(120);
        mWebView.setScrollContainer(true);
        mWebView.bringToFront();
        mWebView.setScrollbarFadingEnabled(true);
        mWebView.setVerticalScrollBarEnabled(true);
        mWebView.setHorizontalScrollBarEnabled(true);
        mWebView.getSettings().setBuiltInZoomControls(true);
        mWebView.getSettings().setJavaScriptEnabled(false);

        mWebView.loadData(this.data, "text/html", "utf-8");

        return this.mView;

Dies ist die search_results.xml

    <?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id ="@+id/search_results"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</WebView>

Und die layout-Datei, in der das fragment geladen wird

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
        android:baselineAligned="false"
        android:weightSum="1.0">

    <LinearLayout android:layout_weight="0.5"
                    android:layout_width="0dip"
                    android:layout_height="match_parent"
                    android:orientation="vertical" >        
<ListView android:id="@id/android:list"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:background="#000000"
           android:drawSelectorOnTop="false"/>
</LinearLayout>
     <LinearLayout android:layout_weight="0.5"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:orientation="vertical" >
                <FrameLayout android:id="@+id/resultsWebWiewFragmentFrame"
                      android:layout_width="match_parent" 
                      android:layout_height="match_parent"/>
    </LinearLayout>
</LinearLayout>

Denn ich bin mit ABS, es ist nicht möglich, laden Sie das fragment direkt in der xml-Datei. Dies werfe eine classcastexception-Fehler.

InformationsquelleAutor wog | 2012-07-26
Schreibe einen Kommentar