2012-04-21 98 views
1

我有webview和listview。 可能是不同的情況。 WebView可以爲空或具有長字符串數據。 另外listview:空或大計數行。 我想在webview中看到數據。向下滾動。在webview之後,我想查看listview的所有數據。我做的是:scrollview - LinearLayout - WebView - ListView。ScrollView中的WebView和ListView

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

<WebView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 
</WebView> 

<ListView 
    android:layout_width="fill_parent" 
    android:layout_weight="1" 
    android:layout_height="wrap_content" > 
</ListView> 

</LinearLayout> 
</ScrollView> 

我看到webview正常。但我看到listview是短小的。任何理由:webview爲空或有數據,listview很快。

+0

嘗試從listView設置中刪除android:layout_weight =「1」。 – Anila 2012-04-21 17:23:11

+5

將ListView放在滾動視圖中並不適用於行爲,只要佈局不確定 – JRaymond 2012-04-21 17:37:14

+0

ListView應始終具有'android:layout_heigth =「fill_parent」'並且如JRaymond所說,不是一種好的做法,在scrollView中放置一個listview 。我建議你看看這段視頻:[ListView的世界] http://www.youtube.com/watch?v=wDBM6wVEO70 – amp 2012-04-21 17:41:04

回答

0

謝謝你們。

我將listview與數據移除到另一個活動。