You can use the include layout. This allows you to create a layout file for your header and one for the footer, and then include these layouts in the main Activity layout. And if you want to include the header + footer in several actions, and there are some in these layouts the events you want to handle, you can create a BaseActivity that handles these events, and then your other actions extend BaseActivity.
Pseudo-code example:
title.xml
<LinearLayout><ImageView/><TextView/></LinearLayout>
footer.xml
<LinearLayout><TextView/><TextView/></LinearLayout>
main.xml
<RelativeLayout> <include layout="@layout/title"/> <WebView /> <include layout="@layout/footer"/> </RelativeLayout>
source share