2011-03-24 52 views
1

我現在正在爲每個佈局添加一個標題,並且正在使用include添加標題。它到目前爲止一直工作得很好,直到我到了一個列表視圖 - 列表視圖現在根本不顯示!ListView在使用後未顯示包括

<?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" 
     android:background="#FFFFFF"> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
     <include android:id="@+id/headerbar" layout="@layout/header" 
       android:layout_height="wrap_content" android:layout_width="fill_parent" /> 
     <ListView android:id="@+id/android:list" 
      android:layout_weight="1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"/> 
     <TextView android:id="@+id/android:empty" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/nothin"/> 
    </LinearLayout> 
    </ScrollView> 

我也試過給0dp的高度,但是這也沒有奏效。有沒有人有任何想法?

編輯:繼承人什麼被包括:

<LinearLayout android:id="@+id/header" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/headerbg" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <ImageButton 
     android:id="@+id/headerButton" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/header" 
     android:background="@null"></ImageButton> 
</LinearLayout> 

回答

2

您需要設置linearlayout的方向屬性,以便它知道如何堆疊元素!

0

是不是因此利用整個屏幕和其餘沒有空間,你的headerandroid:layout_height="fill_parent"這個問題? 如果情況並非如此,您能否展示如何合併layouts