java如何创建页眉和页脚视图,使其与安卓中的每个活动保持一致 1 周,3 日 Questions & Answers 604 我想保持页眉和页脚在所有活动中都是一样的,只要改变页眉和页脚之间的内容就可以了。下面的图片显示了如何做这些事情。请帮忙谢谢
# 1 楼答案 只需对所有活动使用单一布局,如下所示 // Header Activity.. <RelativeLayout> // items in header activity </RelativeLayout> // Footer Activity.. <RelativeLayout> // items in footer activity </RelativeLayout> // In all activity <include android:id=”@+id/header” android:layout_width=”fill_parent” android:layout_height=”fill_parent” layout=”@layout/header_layout”/> <RelativeLayout android:id="@+id/middle_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/header_layout" > // middle layout </RelativeLayout> <include android:id=”@+id/footer” android:layout_width=”fill_parent” android:layout_height=”fill_parent” layout=”@layout/footer_layout”/>
# 1 楼答案
只需对所有活动使用单一布局,如下所示