Webview is making problem in Android HoneyComb
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_pare开发者_运维知识库nt"
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>
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
精彩评论