「フラグメント」の下にUIコンポーネントがある場合は、レイアウト内の各コンポーネントごとに異なるIDを指定する必要があります。
<LinearLayout
android:id="@+id/LinearLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#ff0000"
android:text="Header"
/>
<TextView
android:id="@+id/body"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#00ff00"
android:text="Body"
/>
<TextView
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#0000ff"
android:text="Footer"
/>
</LinearLayout>
メインXMLレイアウト内の他のXMLフラグメントを意味する場合は、同じIDを使用できますが、別のXMLフラグメントでも使用できます。あなたのフラグメントf1
、f2
、f3
を考えると
ああ...それは簡単でした。とても残念な質問と感謝のために申し訳ありません – Semanticer