3

Webview を含む viewflipper があります。場合によっては (一見ランダムに)、Web ビューの下部がジッター/ジャンプするように見えます。これは、1 秒から数秒の間続くことがあります。これは、私が話していることを説明するビデオですhttp://www.youtube.com/watch?v=I8s2P4R95r4

問題を再現する基本的なテスト プロジェクトを作成しましたhttp://dl.dropbox.com/u/1256312/WebView%20Test.rar

この問題は Honeycomb でのみ発生し、通常はランドスケープ モードでのみ発生します。いくつかの 2.x デバイスでテストしましたが、すべて問題ありません。

検索した結果、誰かが Honeycomb で同様の問題を抱えていた別のケースを見つけましたが、その原因はマークアップに関連していると示唆されました。ただし、私が使用しているマークアップは非常に基本的なものであり、いずれにせよ、それを抽出して有効であることを確認しました。

以下は関連するコードです。他の場所にある問題を解消するために、ビューから多くのものを削除しました。View1 にはビューフリッパーがあります。アクティビティでは、タイプ View2 (問題のある Web ビューを含む) の多数のカスタム ビューを作成し、ビューフリッパーに追加します。

ビュー1

    <LinearLayout android:id="@+id/RelativeLayout01"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:orientation="vertical">


        <ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/question_flipper"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_marginLeft="50dp" 
            android:layout_marginRight="50dp" 
            android:layout_marginTop="50dp">

        </ViewFlipper>  

        <RelativeLayout android:id="@+id/FormulaAndResultLayout"
            android:layout_width="fill_parent"
            android:layout_height="75dp"
.....
etc.

ビュー2

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/QuestionLinearLayout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:background="#123123">
    <WebView android:id="@+id/question_web_view"
        android:layout_centerHorizontal="true"
        android:layout_below="@id/question_figure"
        android:layout_marginTop="5dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:scrollbars="none" 
        android:layout_marginLeft="40dp" 
        android:layout_marginRight="40dp" 
        android:background="#444444"/>

</LinearLayout>

ウェブビューの読み込み

qWebView = (WebView) view.findViewById(R.id.question_web_view); 
qWebView.loadDataWithBaseURL(null, String.format(questionHTMLHeader,  qObj.questionText), "text/html", "utf-8", null);
4

1 に答える 1

0

Webビューを動的に作成して初期化してみてください。たとえば、xmlファイルで、Webビュー用のコンテナを準備します。

<LinearLayout android:id="@+id/container_linear_layout"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical">
</LinearLayout>

次に、コード作成でWebビューを初期化し、Webビューをコンテナーに挿入します。

LinearLayout container = (LinearLayout) this.findViewById(R.id.container_linear_layout);
if(container != null)
{
  WebView descriptionWebView = new WebView(context);
  descriptionWebView.loadDataWithBaseURL(null, someStringHtml, "htm", "utf-8", null);

  int margin = RSUtils.convertDpToPixels(10, context);
  LayoutParams layoutParams = new LayoutParams(LayoutParams.FILL_PARENT,
  LayoutParams.WRAP_CONTENT);
  layoutParams.setMargins(margin, 0, margin, 0);
  descriptionWebView.setLayoutParams(layoutParams);

  if(descriptionWebView != null)
     container.addView(descriptionWebView);
}
于 2012-09-03T13:58:07.967 に答える