android布局与流体标头

时间:2012-01-09 16:16:44

标签: android android-layout

我需要为我的Android应用程序创建一个自定义标题。 我会创建类似

的东西
+----------------+------------+
|                |            |
| background     |   Logo     |
|  repeat        |   fixed    |
|                |   right    |
+----------------+------------+
|                             |
|                             |
|        content (list)       |
|                             |
|                             |
|                             |
+-----------------------------+
|        footer repeat        |
+-----------------------------+

现在我已经为列表编写了xml,但我的标题有问题,因为我不知道如何构建它

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#fff" >

<RelativeLayout
    android:id="@+id/top_control_bar"
    android:layout_width="fill_parent"
    android:layout_height="88dp" >

    <View xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="20dp"
        android:background="@drawable/top_menu_bg_tile"/>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="88dp"
        android:src="@drawable/top_menu" />     

</RelativeLayout>

<RelativeLayout
    android:id="@+id/bottom_control_bar"
    android:layout_width="fill_parent"
    android:layout_height="28dp"
    android:layout_alignParentBottom="true">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="28dp"
        android:layout_alignParentBottom="true"
        android:src="@drawable/bottom_menu" />

</RelativeLayout>

<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@id/bottom_control_bar"
    android:layout_below="@id/top_control_bar" >
</ListView>

我还需要知道相对布局是否是我需要编写tablelayout的最佳方式。