我想创建一个顶部有标题栏,底部有导航栏的活动。我曾经include
将标题栏布局和导航栏布局包含在主布局中,如下所示。结果是标题栏和导航栏都到了屏幕的顶部。有人能告诉我为什么吗?谢谢!
<?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>
[编辑] 我没有找到根本原因。但以下工作:
<?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>