0
我有一個簡單的應用程序,它將某些圖像從網絡上拉下來,並通過WebView使用下面的按鈕和上面的標題顯示它們。起初,我有一個在圖像下不斷有額外空白的問題,現在已經解決了。Android Webview中圖像下的額外空白
作爲參考,web視圖定義如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/c"
android:layout_above="@id/b"
android:layout_below="@id/t"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >
<WebView
android:id="@+id/webview"
android:scaleType="centerInside"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true" />
</RelativeLayout>
此相對佈局是另一個內,我離開它。 在活動我有以下幾點:
WebView img = (WebView) findViewById(R.id.webview);
img.getSettings().setBuiltInZoomControls(true);
img.getSettings().setSupportZoom(false);
img.loadUrl(image);
我們當前的問題:
我拉的圖像和觀看具有不同的尺寸。爲簡單起見,讓我們談談兩個尺寸 - X和Y,用X < Y.啓動後,按預期顯示尺寸X的圖像,按下按鈕,尺寸Y的圖像按預期顯示,按下按鈕,如果下一個圖像的尺寸X再次顯示時,會顯示額外的空格(總是在下面),填充到Y的大小。它可能會保留大小爲X的大量圖像或隨機恢復正常。希望我明確這個問題。
我必須以某種方式明確重置邊界嗎?我在Google上做了一些公平的分享,但找不到收穫。
在此先感謝!
最好將您的解決方案作爲答案發布,而不是放在問題文本中。這樣你可以接受答案並結束問題。 – THelper 2011-12-17 19:32:10