Tôi muốn tạo hoạt động có thanh tiêu đề ở trên cùng và thanh điều hướng ở dưới cùng. Tôi đã sử dụng include
để bao gồm bố cục thanh tiêu đề và bố cục thanh điều hướng vào bố cục chính như bạn có thể thấy bên dưới. Kết quả là cả thanh tiêu đề và thanh điều hướng chuyển lên đầu màn hình. Ai đó có thể cho tôi biết tại sao? Cảm ơn!Điều gì xảy ra với sự bao gồm của tôi trong 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="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>
[Chỉnh sửa] Tôi không tìm thấy nguyên nhân gốc rễ. Nhưng các công trình sau:
<?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>
bạn đang ở trong một RelativeLayout, tôi nghĩ rằng bạn quên android: layout_below = "@ id/title_bar" cho thanh nav của bạn – Sephy
Vui lòng cập nhật câu hỏi của bạn để hiển thị các nội dung của 'res/layout/title_bar .xml' và 'res/layout/navigation_bar.xml', sau đó quay lại @ me. – CommonsWare