I have a base layout xml that my activity(s) use:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content_pane"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer_layout">
</FrameLayout>
<include layout="@layout/footer"/>
</RelativeLayout>
Then you can add/replace your fragments to @+id/content_pane (framlayout). And of course you need a footer layout.
To use in your example:
- Add setContentView(R.layout.base); to your activity onCreate-method.
- Change
fm.beginTransaction().add(android.R.id.content, list).commit();
tofm.beginTransaction().add(R.id.content_pane, list).commit();