2014-01-15 12 views
-1

My first Question in Avtivity如何在活動中調整WebView的大小?

Second Question in same Activity

Same First Question But you can see my webView hight increased but not decrease in this question

我的XML文件的WebView

<WebView 
    android:id="@+id/WvQue" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 

任何人都可以告訴我什麼是我面臨的問題?

第一圖象是我在活動的第一個問題 第二次圖像是我在活動的第二個問題 3圖片是我的第一個問題,但它需要的第二個問題的HIGHT如何調整呢?

+0

做你在下面的問題中找到了答案? – Android

回答

0

我認爲,你應該看看這兩個問題

WebView doesn't resize

但是從我看到你需要創建新的WebView每次

WebView height = wrap_content with changing font size doesn't work

而答案太...

編輯 fo [R創造新的WebView編程

Webview in programmatically created RelativeLayout

,這也Im trying to programmatically insert a WebView into my Code

+0

@ShabbirDhangot:我更新http://stackoverflow.com/questions/9765059/webview-height-wrap-content-with-changing-font-size-doesnt-work/21140015#21140015但爲每個答案創建一個新的WebView是可能是一個更簡單的方法。 –

0

你應該在你的代碼中創建的WebView而不是更新它的內容。 以下步驟:

  1. 更換你的WebView標籤在你的佈局文件與以下內容:

    <FrameLayout 
    android:id="@+id/webViewContainer" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 
    </FrameLayout> 
    
  2. 請按照你的Activity類代碼:

    ​​