【问题标题】:Webview is making problem in Android HoneyCombWebview 在 Android HoneyComb 中出现问题
【发布时间】:2011-09-19 07:15:08
【问题描述】:

我正在为 Moto Xoom 开发一个应用程序。我在 webview 中显示一些静态内容,一旦加载内容,向下滚动后,在底部显示一个按钮。

以下是设置为 webview 的属性。

mWebview.setWebViewClient(new WebViewClient());
mWebview.setVerticalScrollBarEnabled(false);
mWebview.getSettings().setJavaScriptEnabled(true);  
mWebview.getSettings().setDefaultZoom(ZoomDensity.MEDIUM);

mWebview.loadData(data, "text/html", "UTF-8");

在布局中,在滚动视图中我添加了一个线性布局,在该线性布局内添加了一个 web 视图,在该按钮下方有一个按钮。

问题是有时 webview 和按钮之间有更多空间,有时它是正确的。

它在三星 Galaxy Tab 中完美运行,这个问题只发生在 Moto Xoom 中。

在此处添加布局:

<ScrollView
    android:id="@+id/ScrollView01"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    android:scrollbars="vertical"
    android:fadingEdge="none"
    android:fadeScrollbars="false">
    <LinearLayout
        android:background="#FFFFFF"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">

        <WebView
            android:id="@+id/webView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        </WebView>
        <Button
            android:layout_height="wrap_content"
            android:id="@+id/btnAccept"
            android:layout_width="wrap_content"
            android:bufferType="normal"
            android:textSize="18dip"
            android:textStyle="bold"
            android:padding="10dip"
            android:layout_margin="10dip"
            android:background="@drawable/btn_terms_iaccept"
            android:layout_gravity="center_horizontal"
            android:visibility="gone"></Button>

    </LinearLayout>
</ScrollView>

【问题讨论】:

  • 请输入布局代码
  • @nik :感谢您的回应,在原帖中添加了布局...

标签: android webview android-3.0-honeycomb


【解决方案1】:

当我们在另一个里面添加两个可滚动控件时,它会产生这些问题,所以我在滚动视图中添加了 textview 而不是 webview。并使用以下行。我已经直接在textview中加载了html内容。

txtViewContent.setText(Html.fromHtml(data)); // 数据是html字符串

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-23
    • 1970-01-01
    • 2012-01-25
    • 1970-01-01
    • 2016-09-27
    • 1970-01-01
    • 1970-01-01
    • 2020-02-12
    相关资源
    最近更新 更多