无法重新膨胀片段对话框Xamarin和C#

时间:2016-09-27 19:19:16

标签: c# android android-fragments xamarin xamarin.android

我的片段对话框出现问题。我有一个listview&当我点击单个列表视图项时,我可以进入片段对话框。

但是当我回到持有listview&amp ;;的父母那里时尝试重新进入片段对话框我收到此错误。

Android.Views.InflateException: Binary XML file line #1: Error inflating class fragment

给我错误的行是

var view = inflater.Inflate(Resource.Layout.dialog_preview_busn, container, false);

这是XML文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/dialogLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:minWidth="300dp"
android:minHeight="200dp"
android:weightSum="100"
android:gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="15"
android:id="@+id/relativeLayout2"
android:minWidth="25px"
android:minHeight="25px">
<ProgressBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_marginBottom="5dp"
    android:indeterminate="true"
    android:background="@drawable/progressBarDesign"
    android:id="@+id/fragProgress"
    android:visibility="invisible" />
</RelativeLayout>
<TextView
    android:text=""
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="10"
    android:gravity="center"
    android:textSize="20sp"
    android:id="@+id/txtName" />
<LinearLayout
    android:background="@drawable/dialogLayout"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="5">
    <LinearLayout
        android:background="@drawable/dialogLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="100">
        <TextView
            android:text="Address:  "
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="right"
            android:textSize="15sp"
            android:id="@+id/labAddess" />
        <TextView
            android:text=""
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="left"
            android:textSize="15sp"
            android:id="@+id/txtAddress"
            android:layout_below="@id/txtName" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:background="@drawable/dialogLayout"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="5">
    <LinearLayout
        android:background="@drawable/dialogLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="100">
        <TextView
            android:text="Number:  "
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="right"
            android:textSize="15sp"
            android:id="@+id/labNumber" />
        <TextView
            android:text=""
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="left"
            android:textSize="15sp"
            android:id="@+id/txtNumber"
            android:layout_below="@id/txtAddress" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:background="@drawable/dialogLayout"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="5">
    <LinearLayout
        android:background="@drawable/dialogLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="100">
        <TextView
            android:text="Email:  "
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="right"
            android:textSize="15sp"
            android:id="@+id/labEmail" />
        <TextView
            android:text=""
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="left"
            android:textSize="15sp"
            android:id="@+id/txtEmail"
            android:layout_below="@id/txtNumber" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:background="@drawable/dialogLayout"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="5">
    <LinearLayout
        android:background="@drawable/dialogLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="100">
        <TextView
            android:text="Website:  "
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="right"
            android:textSize="15sp"
            android:id="@+id/labEmail" />
        <TextView
            android:text=""
            android:layout_width="0dp"
            android:layout_weight="50"
            android:layout_height="fill_parent"
            android:gravity="left"
            android:textSize="15sp"
            android:id="@+id/txtWebsite"
            android:layout_below="@id/txtEmail" />
    </LinearLayout>
</LinearLayout>
<TextView
    android:text="Hours"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="5"
    android:gravity="center"
    android:textSize="15sp"
    android:id="@+id/labHours"
    android:layout_below="@id/txtWebsite" />
<TextView
    android:text=""
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="5"
    android:gravity="center"
    android:textSize="15sp"
    android:id="@+id/txtHours"
    android:layout_below="@id/labEmail" />
<ImageView
    android:layout_width="30sp"
    android:layout_height="30sp"
    android:paddingTop="6sp"
    android:layout_gravity="center"
    android:background="#4A115C"
    android:src="@drawable/menu_down_arrow"
    android:id="@+id/downArrow"/>
<LinearLayout
    android:background="@drawable/dialogLayout"
    android:id="@+id/mapLayout"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="5">
<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="200sp"
    android:layout_marginLeft="10sp"
    android:layout_marginRight="10sp"
    android:layout_marginTop="15sp"
    android:layout_marginBottom="10sp"
    android:name="com.google.android.gms.maps.MapFragment" />
</LinearLayout>
</LinearLayout>

调用对话框片段的代码块。此代码位于listview_ItemLongClick(对象发件人,AdapterView.ItemLongClickEventArgs e)内。

Android.App.FragmentTransaction transaction_prev = FragmentManager.BeginTransaction().AddToBackStack(null);
        dialog_preview_busn previewBusn = new dialog_preview_busn(gName, gAddress, gZip, gNumber, gEmail, gWebsite, gHours, gImage);
        previewBusn.Show(transaction_prev, "Dialog Preview Business");

发生错误时调试器的完整输出:

        Unhandled Exception:

    Android.Views.InflateException: Binary XML file line #1: Error inflating class fragment

    09-27 13:43:22.963 D/Mono    ( 2359): DllImport attempting to load: '/system/lib/liblog.so'.
    09-27 13:43:22.963 D/Mono    ( 2359): DllImport loaded library '/system/lib/liblog.so'.
    09-27 13:43:22.963 D/Mono    ( 2359): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
    09-27 13:43:22.963 D/Mono    ( 2359): Searching for '__android_log_print'.
    09-27 13:43:22.963 D/Mono    ( 2359): Probing '__android_log_print'.
    09-27 13:43:22.963 D/Mono    ( 2359): Found as '__android_log_print'.
    09-27 13:43:22.983 I/MonoDroid( 2359): UNHANDLED EXCEPTION:
    09-27 13:43:23.003 I/MonoDroid( 2359): Android.Views.InflateException: Binary XML file line #1: Error inflating class fragment ---> Java.Lang.IllegalArgumentException: Binary XML file line #1: Duplicate id 0x7f0a001d, tag null, or parent id 0x7f0a001c with another fragment for com.google.android.gms.maps.MapFragment
    09-27 13:43:23.003 I/MonoDroid( 2359):   --- End of managed Java.Lang.IllegalArgumentException stack trace ---
    09-27 13:43:23.003 I/MonoDroid( 2359): java.lang.IllegalArgumentException: Binary XML file line #1: Duplicate id 0x7f0a001d, tag null, or parent id 0x7f0a001c with another fragment for com.google.android.gms.maps.MapFragment
    09-27 13:43:23.003 I/MonoDroid( 2359):  at android.app.Activity.onCreateView(Activity.java:4940)
    09-27 13:43:23.003 I/MonoDroid( 2359):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
    09-27 13:43:23.003 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
    09-27 13:43:23.003 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
    09-27 13:43:23.003 I/MonoDroid( 2359):  at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
    09-27 13:43:23.003 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.n_onCreateView(Native Method)
    09-27 13:43:23.003 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.onCreateView(dialog_preview_busn.java:45)
    09-27 13:43:23.003 I/MonoDroid( 2359):  at android.app.Fragment.performCreateView(Fragment.java:1700)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.app.BackStackRecord.run(BackStackRecord.java:684)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.os.Handler.handleCallback(Handler.java:733)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.os.Handler.dispatchMessage(Handler.java:95)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.os.Looper.loop(Looper.java:157)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at android.app.ActivityThread.main(ActivityThread.java:5293)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at java.lang.reflect.Method.invokeNative(Native Method)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at java.lang.reflect.Method.invoke(Method.java:515)
    09-27 13:43:23.013 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at dalvik.system.NativeStart.main(Native Method)
    09-27 13:43:23.023 I/MonoDroid( 2359):   --- End of managed Java.Lang.IllegalArgumentException stack trace ---
    09-27 13:43:23.023 I/MonoDroid( 2359): java.lang.IllegalArgumentException: Binary XML file line #1: Duplicate id 0x7f0a001d, tag null, or parent id 0x7f0a001c with another fragment for com.google.android.gms.maps.MapFragment
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.app.Activity.onCreateView(Activity.java:4940)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.n_onCreateView(Native Method)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.onCreateView(dialog_preview_busn.java:45)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.app.Fragment.performCreateView(Fragment.java:1700)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
    09-27 13:43:23.023 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at android.app.BackStackRecord.run(BackStackRecord.java:684)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at android.os.Handler.handleCallback(Handler.java:733)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at android.os.Handler.dispatchMessage(Handler.java:95)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at android.os.Looper.loop(Looper.java:157)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at android.app.ActivityThread.main(ActivityThread.java:5293)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at java.lang.reflect.Method.invokeNative(Native Method)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at java.lang.reflect.Method.invoke(Method.java:515)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    09-27 13:43:23.033 I/MonoDroid( 2359):  at dalvik.system.NativeStart.main(Native Method)
    09-27 13:43:23.033 I/MonoDroid( 2359):   --- End of inner exception stack trace ---
    09-27 13:43:23.033 I/MonoDroid( 2359):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
    09-27 13:43:23.033 I/MonoDroid( 2359):   at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00085] in /Users/builder/data/lanes/3540/1cf254db/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11283 
    09-27 13:43:23.033 I/MonoDroid( 2359):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00031] in /Users/builder/data/lanes/3540/1cf254db/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:350 
    09-27 13:43:23.043 I/MonoDroid( 2359):   at Android.Views.LayoutInflater.Inflate (System.Xml.XmlReader parser, Android.Views.ViewGroup root, Boolean attachToRoot) [0x0005b] in /Users/builder/data/lanes/3540/1cf254db/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.LayoutInflater.cs:725 
    09-27 13:43:23.043 I/MonoDroid( 2359):   at My_Town_App.Droid.dialog_preview_busn.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x0000b] in C:\Users\Owner\documents\visual studio 2015\Projects\My_Town_App\My_Town_App\My_Town_App.Droid\dialog_preview_busn.cs:99 
    09-27 13:43:23.043 I/MonoDroid( 2359):   at Android.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState) [0x00022] in /Users/builder/data/lanes/3540/1cf254db/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Fragment.cs:1612 
    09-27 13:43:23.043 I/MonoDroid( 2359):   at (wrapper dynamic-method) System.Object:7764fb92-ef49-4334-84ad-92014396e88a (intptr,intptr,intptr,intptr,intptr)
    09-27 13:43:23.043 I/MonoDroid( 2359):   --- End of managed Android.Views.InflateException stack trace ---
    09-27 13:43:23.043 I/MonoDroid( 2359): android.view.InflateException: Binary XML file line #1: Error inflating class fragment
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.n_onCreateView(Native Method)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.onCreateView(dialog_preview_busn.java:45)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.app.Fragment.performCreateView(Fragment.java:1700)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.app.BackStackRecord.run(BackStackRecord.java:684)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.os.Handler.handleCallback(Handler.java:733)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.os.Handler.dispatchMessage(Handler.java:95)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.os.Looper.loop(Looper.java:157)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at android.app.ActivityThread.main(ActivityThread.java:5293)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at java.lang.reflect.Method.invokeNative(Native Method)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at java.lang.reflect.Method.invoke(Method.java:515)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    09-27 13:43:23.043 I/MonoDroid( 2359):  at dalvik.system.NativeStart.main(Native Method)
    09-27 13:43:23.053 I/MonoDroid( 2359): Caused by: java.lang.IllegalArgumentException: Binary XML file line #1: Duplicate id 0x7f0a001d, tag null, or parent id 0x7f0a001c with another fragment for com.google.android.gms.maps.MapFragment
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.Activity.onCreateView(Activity.java:4940)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
    09-27 13:43:23.053 I/MonoDroid( 2359):  ... 20 more
    09-27 13:43:23.053 I/MonoDroid( 2359):   --- End of managed Android.Views.InflateException stack trace ---
    09-27 13:43:23.053 I/MonoDroid( 2359): android.view.InflateException: Binary XML file line #1: Error inflating class fragment
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.n_onCreateView(Native Method)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at md5acfef63ba52ffd159bb4b4b5411a5ab5.dialog_preview_busn.onCreateView(dialog_preview_busn.java:45)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.Fragment.performCreateView(Fragment.java:1700)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.BackStackRecord.run(BackStackRecord.java:684)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.os.Handler.handleCallback(Handler.java:733)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.os.Handler.dispatchMessage(Handler.java:95)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.os.Looper.loop(Looper.java:157)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at android.app.ActivityThread.main(ActivityThread.java:5293)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at java.lang.reflect.Method.invokeNative(Native Method)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at java.lang.reflect.Method.invoke(Method.java:515)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    09-27 13:43:23.053 I/MonoDroid( 2359):  at dalvik.system.NativeStart.main(Native Method)
    09-27 13:43:23.053 I/MonoDroid( 2359): Caused by: java.lang.IllegalArgumentException: Binary XML file line #1: Duplicate id 0x7f0a001d, tag null, or parent id 0x7f0a001c with another fragment for com.google.android.gms.maps.MapFragment
    09-27 13:43:23.063 I/MonoDroid( 2359):  at android.app.Activity.onCreateView(Activity.java:4940)
    09-27 13:43:23.063 I/MonoDroid( 2359):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
    09-27 13:43:23.063 I/MonoDroid( 2359):  ... 20 more
    09-27 13:43:23.073 D/Mono    ( 2359): DllImport searching in: '__Internal' ('(null)').
    09-27 13:43:23.073 D/Mono    ( 2359): Searching for 'java_interop_jnienv_throw'.
    09-27 13:43:23.073 D/Mono    ( 2359): Probing 'java_interop_jnienv_throw'.
    09-27 13:43:23.073 D/Mono    ( 2359): Found as 'java_interop_jnienv_throw'.
    An unhandled exception occured.

    In mgmain JNI_OnLoad

1 个答案:

答案 0 :(得分:1)

堆栈跟踪会出现以下错误:

* { margin: 0px; padding: 0px; max-width: 100%; box-sizing: border-box; -webkit-font-smoothing: subpixel-antialiased; }

您可以在此处详细了解此问题:Duplicate ID, tag null, or parent id with another fragment for com.google.android.gms.maps.MapFragment

因此,您可能希望使用Duplicate id 0x7f0a001d, tag null, or parent id 0x7f0a001c with another fragment for com.google.android.gms.maps.MapFragment来确保不会在片段内膨胀片段。确保在添加其他片段之前将其删除。

这里有关于此的说明:https://developer.android.com/about/versions/android-4.2.html#NestedFragments

  

注意:当布局包含replace()时,您无法将布局扩展为片段。只有动态添加到片段时才支持嵌套片段。