I want to create an activity with a title bar at top and a navigation bar at bottom. I used include to include the title bar layout and the navigation bar layout into the main layout as below. But, as a result, both the title bar and navigation bar went to the top of the screen. Could someone tell me why? Thanks!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_widget" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background">
<include android:id="@+id/title_bar" layout="@layout/title_bar"
android:layout_alignParentTop="true"
/>
<include android:id="@+id/navigation_bar" layout="@layout/navigation_bar"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
Edit: I didn't find the root cause. But the following works:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_widget" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background">
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="@+id/title_bar"
>
<include layout="@layout/title_bar"
/>
</RelativeLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="@+id/navigation_bar"
>
<include layout="@layout/navigation_bar"
/>
</RelativeLayout>