我现在正在为每个布局添加标题,并使用include进行操作。到目前为止,它一直工作正常,直到我进入列表视图 - 列表视图现在根本没有显示!
<?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>
答案 0 :(得分:2)
您需要设置linearlayout的orientation属性,以便它知道如何堆叠元素!
答案 1 :(得分:0)
问题是header
android:layout_height="fill_parent"
因此使用整个屏幕而其余部分没有空间吗?
如果不是这种情况,您能否说明如何合并layouts
?