我有一个包含 webview 的 viewflipper。在某些情况下(看似随机),webview 的底部会出现抖动/跳跃。这可以持续一秒钟到几秒钟之间的任何时间。这是一个视频来说明我在说什么http://www.youtube.com/watch?v=I8s2P4R95r4
我现在创建了一个重现问题的基本测试项目http://dl.dropbox.com/u/1256312/WebView%20Test.rar
该问题仅在 Honeycomb 中出现,并且通常仅在横向模式下出现。我已经在几个 2.x 设备上进行了测试,一切都很好。
经过搜索,我发现了另一个案例,有人在 Honeycomb 中遇到了类似的问题,但他们认为原因与标记有关。但是我使用的标记非常基本,无论如何我已经提取了它并确保它是有效的。
下面是相关代码。我已经从视图中删除了很多东西,以消除其他地方的问题。View1 有一个取景器。在活动中,我创建了许多 View2 类型的自定义视图(其中包含有问题的 web 视图)并将它们添加到 viewflipper。
视图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);