Webview is making problem in Android HoneyComb

强颜欢笑 提交于 2019-12-25 04:08:09

问题


I am developing an application for Moto Xoom. I am displaying some static content in the webview, once the content is loaded, after scrolling down, displaying one button in the bottom.

Following are the properties set to webview.

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

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

In Layout, inside the scroll view I have added one linearlayout, inside that linearlayout one webview and below to that a button is there.

The issue is sometimes there is more space between the webview and button, sometimes its proper.

And it is perfectly working in Samsung Galaxy Tab, this issues happens only in Moto Xoom.

Adding the layout here:

<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>

回答1:


When we add two scrollable controls one inside the other then its giving these kind of issues, so instead of webview I have added the textview inside the scrollview. And using the following line. I have loaded html content in the textview directly.

txtViewContent.setText(Html.fromHtml(data)); // data is html string



来源:https://stackoverflow.com/questions/7467548/webview-is-making-problem-in-android-honeycomb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!