I am developing an andorid application with navigation drawer
and I have a layout for contentview like this:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:dividerHeight="0dp"
android:divider="@android:color/transparent"
android:background="@color/default_color"/>
</android.support.v4.widget.DrawerLayout>
So I can add and replace fragment on navigation drawer item click. Everything okay till now.
But in one case, on clicking an item on navigation drawer I need to show two fragments instead of one ( just like a listFragment and details fragment ). How can I do it? Should I add two fragments into the framelayout then? But how? or should I change the contentView with different drawerLayout
? If yes, how can I do this?