我疯了,试图做一个相对的布局工作。当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