【问题标题】:Android Webview on ICS (Ice Cream Sandwich)ICS 上的 Android Webview(冰淇淋三明治)
【发布时间】:2012-01-28 02:52:21
【问题描述】:

ICS 上的 Webview 看起来很糟糕。下面的代码在 2.x 模拟器上不显示任何内容,但在 ICS 模拟器上显示半页白屏。下面的布局是用于测试 porpuses。如果我在 ICS 上的 webview 中放置一些 html 来呈现它,它不会显示半页然后继续像它呈现了一半但我只看到白色的空白区域。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />
<WebView
    android:id="@+id/webView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
</WebView>    

</LinearLayout>

有人知道吗?

【问题讨论】:

    标签: android webview


    【解决方案1】:

    我猜你应该让 webview fill_parent(或 match_parent),或者给出宽度和高度,我不确定,但我猜它不会很聪明“包装到内容”,因为 webview 内容很难测量。

    也就是说,我在 ICS 上的 webview 有成千上万个问题:没有刷新窗口、硬件加速导致各种伪像、iframe 问题、屏幕闪烁、浏览器在 CSS3 动画上崩溃等等。这些问题大部分是新问题在 ICS 上,而硬件加速等其他技术并不新鲜,但已经明显恶化。

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,或者至少是一个非常相似的问题。我所拥有的是一个 WebView,它在横向时水平居中并填充垂直空间。 WebView 定位正确,但看起来实际呈现的屏幕区域与屏幕左侧对齐,但与 WebView 的宽度相同。这会导致仅部分 WebView 呈现,其余部分显示为背景颜色。所以在 4.0 中似乎确实存在某种错误,因为它在我测试过的 2.3 和 3.2 设备上运行良好。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-03-26
        • 1970-01-01
        • 2012-05-02
        • 1970-01-01
        • 2013-03-29
        • 1970-01-01
        • 2012-03-11
        • 1970-01-01
        相关资源
        最近更新 更多