我正在使用以下代码将我的webview缩放以适应屏幕宽度:
这个方法可以解决问题,但是现在我的内容底部会出现一片空白区域。这片空白区域的高度与缩放大小成正比关系。所以对于较小的设备,这个空白区域的大小更大。
我认为滚动条的大小在缩放后没有被重新计算。这种假设是因为当通过点击屏幕进行缩放时,空白区域消失了。虽然Android 2.3上运行良好,但在4.0上却不行。
我的问题是如何强制滚动条在缩放后重新计算。或者是否有其他解决方案。
谢谢。
附:以下是我在xml文件中定义webview的方式。
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setBuiltInZoomControls(true);
这个方法可以解决问题,但是现在我的内容底部会出现一片空白区域。这片空白区域的高度与缩放大小成正比关系。所以对于较小的设备,这个空白区域的大小更大。
我认为滚动条的大小在缩放后没有被重新计算。这种假设是因为当通过点击屏幕进行缩放时,空白区域消失了。虽然Android 2.3上运行良好,但在4.0上却不行。
我的问题是如何强制滚动条在缩放后重新计算。或者是否有其他解决方案。
谢谢。
附:以下是我在xml文件中定义webview的方式。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF" >
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/web_view"
android:background="#AAFFFFFF"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>