Skip to content Skip to sidebar Skip to footer

Textview In Android Fragment Duplicated In Landscape Layout

I am trying to make an app with two fragments, one containing a list of groups (called OverviewFragment) and one fragment containing the details of selected group (called DetailsFr

Solution 1:

try using FrameLayouts instead of your custom fragments in the xml file:

<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:configChanges="keyboardHidden|orientation|screenSize"android:orientation="horizontal"android:id="@+id/activity_main"android:tag="landscape"><FrameLayoutandroid:id="@+id/overview_fragment"android:layout_weight="1"android:layout_width="0dp"android:layout_height="match_parent" /><FrameLayoutandroid:id="@+id/details_fragment"android:layout_weight="2"android:layout_width="0dp"android:layout_height="match_parent" /></LinearLayout>

in your way, you are creating each fragment twice. good luck :)

Post a Comment for "Textview In Android Fragment Duplicated In Landscape Layout"