gpt4 book ai didi

c# - 无法重新膨胀 fragment 对话框 Xamarin 和 C#

转载 作者:行者123 更新时间:2023-11-30 00:58:57 27 4
gpt4 key购买 nike

我的 fragment 对话框有问题。我有一个 ListView ,当我单击单个 ListView 项时,我可以进入 fragment 对话框。

但是当我回到持有 ListView 的父级并尝试重新进入 fragment 对话框时,我收到了这个错误。

Android.Views.InflateException:二进制 XML 文件第 1 行:扩展类 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>

调用对话 fragment 的代码块。此代码位于 listview_ItemLongClick(object sender, 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

最佳答案

堆栈跟踪给出了以下错误:

Duplicate id 0x7f0a001d, tag null, or parent id 0x7f0a001c with another fragment for com.google.android.gms.maps.MapFragment

您可以在此处阅读有关此问题的更多信息:Duplicate ID, tag null, or parent id with another fragment for com.google.android.gms.maps.MapFragment

所以你可能想使用 replace()以确保您不会在 fragment 内膨胀 fragment 。确保在添加另一个 fragment 之前删除之前的 fragment 。

这里有一个注释:https://developer.android.com/about/versions/android-4.2.html#NestedFragments

Note: You cannot inflate a layout into a fragment when that layout includes a <fragment>. Nested fragments are only supported when added to a fragment dynamically.

关于c# - 无法重新膨胀 fragment 对话框 Xamarin 和 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39732666/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com