In an application, there are usually multiple activities, each of which corresponds to a UI layout file. In general, in order to maintain a uniform style between different windows, many identical la s will be used in these UI layout files. If we rewrite the same layout in every xml file, one is code redundancy and poor readability, and the other is difficult to modify, which is very unfavorable for later modification and maintenance. Therefore, in general, we need to write code with the same layout into a single module. Then, we can reuse the layout code through the <include/> label when using it. Normally, some applications have a title bar at the top. Similar. Example of the title bar of the figure. if most of the Activity la s in the project contain such a title bar, you can separate the la s of the title bar into an xml file. <RelativeLayout android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: gravity = "center" android: background = "@ drawable/navigator_bar_bg" xmlns: android = "http://schemas.android.com/apk/res/android"> <TextView android: id = "@ android: id/title" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_centerVertical = "true" android: gravity = "center" andro Id: hint = "title" android: textAppearance = "? Android: attr/textAppearanceMedium "/> <ImageView android: id =" @ android: id/closeButton "android: layout_width =" wrap_content "android: layout_height =" wrap_content "android: layout_alignParentRight = "true" android: src = "@ drawable/close"/> </RelativeLayout> name the preceding xml file "navigator_bar.xml ", you can directly reference the xml layout file of other Activity that requires the title bar. <Include layout = "@ layout/navigator_bar"/> Experience Sharing: Generally, the overall UI style can be roughly determined at the beginning of the project. Therefore, you can make some planning in the early stages and write out the common modules first. The following is a shared layout that may be extracted: 1) background. Some applications use a unified background on different interfaces. The Default background may be modified frequently in the future, so the background can be made into a common module. 2) title bar of the header. If the application has a uniform header title bar, it can be extracted. 3) navigation bar at the bottom. If the application has a navigation bar and most activities have the same navigation bar at the bottom, you can write the navigation bar as a common module. 4) ListView. Most applications use ListView to display multiple data entries. The style of ListView may be adjusted frequently in the later stage of the project, so it is better to use ListView as a common module.