我瘋了,試圖做一個相對的佈局工作。當ListView出現問題時,listView總是顯示一個空白空間,大約是一個listView元素高度的兩倍,如果列表大小足以滾動或不滾動(通常該列表容納4個元素而不需要滾動) 。帶有ListView的RelativeLayout沒有正確顯示
爲了解決這個問題,我試圖實現一個RelativeLayout。我有一個TextView在頂部,一個在底部,我的列表視圖在中間。在我的列表視圖TextView的公司必須「粘」,我用的LinearLayout的空白問題之前,現在我有這個相對佈局:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/background"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="fill_parent">
...
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+datatrade/tv_itens"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Itens:" />
<TextView
android:id="@+datatrade/tv_value"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Value:" />
<ListView android:layout_width="fill_parent"
android:layout_height="200px"
android:layout_below="@datatrade/tv_itens"
android:layout_above="@datatrade/tv_value"
android:id="@+id/list_product"
/>
</RelativeLayout>
...
的問題是,我剛剛得到顯示我的第二個文本視圖,與「價值觀:」,沒有別的! 所有其餘的相對佈局被android忽略!
有誰知道可能是什麼問題?
我試圖與Android的位置:layout_alignParentTop在我的TextView =「真」沒有宣佈(這個)一切位置還是很喜歡它,只顯示這個textView。 – IPValverde
對不起我的問題..你想添加頁眉和頁腳到列表視圖? – Blackbelt
然後你添加與android:layout_alignParentTop =「true」的東西。你嘗試過android:layout_alignParentBottom =「true」嗎? – Blackbelt