现在,我在每个布局中添加一个标题,并使用一个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>
最佳答案
您需要设置linearlayout的direction属性,以便它知道如何堆叠元素!
关于android - 使用包括后不显示ListView,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5424760/