我有一个列表视图,想要在它的上方(y轴)和下方(y轴)放置包括图像、文本视图和一排按钮在内的内容。以下是我正在创建的简化版本。不幸的是,列表覆盖了头部,因此头部文本不可见,而不是在下面(y轴上)。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/footer"
android:text="footer"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
/>
<ListView android:id="@+id/list_view"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_above="@id/footer"
android:background="#ff9999ff"/>
<TextView android:id="@+id/header"
android:text="header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentTop="true"
android:layout_above="@id/list_view"
android:baselineAlignBottom="false"
/>
</RelativeLayout>
以下是相应的Activity类:
public class SampleListActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_activity);
}
}