2010-05-17 65 views
5

有沒有人有任何想法我怎麼能得到一個具有以下描述的視圖: 在頁面頂部有一個自定義測試,並在下面顯示來自url的內容。目前我的佈局是以下內容:顯示一個WebView

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
    <TextView 
     android:id="@id+/test" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
    /> 

<WebView 
    android:id="@+id/webview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
/> 

</LinearLayout> 

在上創建應用程序嚴密,這個佈局我與findViewById TextView的並設置文本爲它的。類似的,我得到WebView並調用它的loadUrl(「url」),但行爲不是預期的。首先簡要顯示文本集,然後顯示包含傳遞網址內容的全屏瀏覽器頁面。

回答

5

android:layout_weight='1'添加到WebView。

+0

它的工作原理。有一件事,webview不在文本下方,但文本似乎在webview表面呈現。 – 2010-05-17 17:21:08

+0

Hrmm,我剛創建了一個測試應用程序,它爲我工作。也許你的代碼中有其他東西導致這個問題? – synic 2010-05-17 17:51:50

+0

噢,好吧,我會解決它...再次感謝! – 2010-05-17 19:23:58