ダイアログフラグメントの xml レイアウトにフラグメントを追加しようとしていますが、機能していません。ダイアログフラグメントを開こうとすると、フラグメントがレイアウトに含まれているためにアプリがクラッシュします
以下はxmlレイアウトです
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/flContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding = "10dp"
class="com.OptimusApps.stayhealthy.AndroidXMLParsingActivity" />
</LinearLayout>
これは私のlogcatです
08-17 19:59:02.316: E/AndroidRuntime(5222): FATAL EXCEPTION: main
08-17 19:59:02.316: E/AndroidRuntime(5222): android.view.InflateException: Binary XML file line #7: Error inflating class fragment
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
08-17 19:59:02.316: E/AndroidRuntime(5222): at com.OptimusApps.stayhealthy.BodyDialogue.onCreateView(BodyDialogue.java:64)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1470)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:925)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:299)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
08-17 19:59:02.316: E/AndroidRuntime(5222): at com.OptimusApps.stayhealthy.BodyDialogue.onCreateView(BodyDialogue.java:64)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1470)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:925)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1102)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1458)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:438)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.os.Handler.handleCallback(Handler.java:605)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.os.Handler.dispatchMessage(Handler.java:92)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.os.Looper.loop(Looper.java:137)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.app.ActivityThread.main(ActivityThread.java:4575)
08-17 19:59:02.316: E/AndroidRuntime(5222): at java.lang.reflect.Method.invokeNative(Native Method)
08-17 19:59:02.316: E/AndroidRuntime(5222): at java.lang.reflect.Method.invoke(Method.java:511)
08-17 19:59:02.316: E/AndroidRuntime(5222): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
08-17 19:59:02.316: E/AndroidRuntime(5222): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
08-17 19:59:02.316: E/AndroidRuntime(5222): at dalvik.system.NativeStart.main(Native Method)
以下はそれが原因であり、それを修正する方法がわかりません
08-17 19:59:02.316: E/AndroidRuntime(5222): Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Duplicate id 0x7f0a0031, tag null, or parent id 0x0 with another fragment for com.OptimusApps.stayhealthy.AndroidXMLParsingActivity
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:285)
08-17 19:59:02.316: E/AndroidRuntime(5222): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
08-17 19:59:02.316: E/AndroidRuntime(5222): ... 30 more