WebView 大小正在扩大,但没有按照其中的文字缩小 [英] WebView size is expanding but not contracting as per the text in it
问题描述
我使用 WebView 来显示解析的 XML 和 HTML 内容.我已将 webview 的 layout_height 设置为 wrap_content.当物质较大时它工作正常,但当物质较小时它不会包裹它,下面的空间保持白色.请告诉我每次更改 webView 中的内容时如何包装它.
<Button android:layout_height = "wrap_content"机器人:layout_width =0dp"android:id = "@+id/previousdata"机器人:文本=返回"机器人:layout_weight =1"android:layout_gravity="center_vertical"/><Button android:layout_height = "wrap_content"机器人:layout_width =0dp"android:id = "@+id/nextdata"机器人:layout_weight =1"机器人:文本=下一个"android:layout_gravity="center_vertical"/></LinearLayout></LinearLayout></ScrollView>
现在我遇到的问题是,如果我在纵向模式下运行我的应用程序,webView 会提供额外的空白而不是根据数据收缩,但是如果我将方向更改为横向,空白会减少......请解释我的观点发生了什么,以及如何减少额外的空白......提前谢谢......
Android 属性: android:layout_weight = "1
in the layout should work...>
I am using WebView to show parsed XML and HTML content. I have set the layout_height of webview to wrap_content. It works fine when the matter is large in size but when the matter is small it do not wrap to it the below space remains white. pls tell me how to wrap it each time when I change content in webView.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background = "#ffffff"
>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background = "#ffffff" >
<WebView android:layout_height = "wrap_content"
android:layout_width = "wrap_content"
android:id = "@+id/webcontent"
/>
<LinearLayout android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal"
android:id = "@+id/buttons"
android:background="#ffffff">
<Button android:layout_height = "wrap_content"
android:layout_width = "0dp"
android:id = "@+id/previousdata"
android:text = "Back"
android:layout_weight = "1"
android:layout_gravity="center_vertical"/>
<Button android:layout_height = "wrap_content"
android:layout_width = "0dp"
android:id = "@+id/nextdata"
android:layout_weight = "1"
android:text = "Next"
android:layout_gravity="center_vertical"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
Now I am getting the problem that if I am running my app in portrait mode the webView is giving extra white space and not contracting according to the data, but if I change the orientation to landscape the white space diminished... Plz explain what's happening to my view and how can I diminish the extra white space... thanx in advance...
Android property: android:layout_weight = "1
in the layout should work...
这篇关于WebView 大小正在扩大,但没有按照其中的文字缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!