So fügen Sie zur Laufzeit zwei Fragmente in einem frameLayout zusammen
Ich entwickle eine andorid Anwendung mitnavigation drawer
und ich habe ein Layout für die Inhaltsansicht wie folgt:
<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 kann ich Fragment auf Navigationsfachelementklick hinzufügen und ersetzen. Alles in Ordnung bis jetzt.
In einem Fall muss ich beim Klicken auf ein Element in der Navigationsleiste zwei Fragmente anstelle von einem anzeigen (genau wie bei einem Fragment listFragment und details). Wie kann ich es tun? Soll ich dann zwei Fragmente in das Framelayout geben? Aber wie? oder soll ich die contentView mit anderen änderndrawerLayout
? Wenn ja, wie kann ich das machen?