二进制XML文件行#1:错误膨胀类Mvx.MvxListView

时间:2014-04-09 15:28:14

标签: android mono mvvmcross android-inflate

当我尝试给只有mvxlistview的布局进行充气时,我遇到了一个错误,导致类Mvx.MvxListView错误。我有一个父视图,包含两个子视图,他的主人和详细信息。主视图必须只有listview作为对象。当我尝试给只有mvxlistview的xml充气时,应用程序崩溃并出现以下错误。这是xml和错误的类。

MasterView:

public class SpaceMasterView : LinearLayout
    {
        public SpaceMasterView(Context context, IAttributeSet attr ): base(context, attr)
        {
            var inflator = LayoutInflater.FromContext (context);

            if(inflator != null){
                inflator.Inflate(Resource.Layout.Dox_Space_SpaceView_Master, this);
            }
        }

    }

Xml文件:

<Mvx.MvxListView    xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
local:MvxBind="ItemsSource SubFolders;ItemClick SelectFolderCommand"
local:MvxItemTemplate="@layout/dox_space_spaceview_master_listitem"
android:id="@+id/listview_spaceview_master_folders"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="24dp"/>

这就是错误。任何人都可以帮我理解这里出了什么问题。

[MonoDroid] UNHANDLED EXCEPTION: Android.Views.InflateException: Exception of type 'Android.Views.InflateException' was thrown.
[MonoDroid] at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00064] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/0deb0164/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:194
[MonoDroid] at Android.Views.LayoutInflater.Inflate (int,Android.Views.ViewGroup) [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/0deb0164/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Views.LayoutInflater.cs:575
[MonoDroid] at MobileDox.Android.SpaceMasterView..ctor (Android.Content.Context,Android.Util.IAttributeSet) [0x0001e] in /Users/iibrahimi/Source/DOXMobile/MobileDox.frontend/MobileDox.Android/Views/Dox/Space/SpaceMasterView.cs:30
[MonoDroid] at (wrapper dynamic-method) object.bd9a81cb-ba0e-461d-9c35-fa6fab92a43d (intptr,object[]) <IL 0x00030, 0x00093>
[MonoDroid] at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) [0x000c2] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/0deb0164/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:156
[MonoDroid] at (wrapper dynamic-method) object.5e425f1a-486c-4e5b-a4ef-dd0938379cd0 (intptr,intptr,intptr,intptr,intptr,intptr) <IL 0x00029, 0x0007b>
[MonoDroid] 
[MonoDroid]   --- End of managed exception stack trace ---
[MonoDroid] android.view.InflateException: Binary XML file line #1: Error inflating class Mvx.MvxListView
[MonoDroid]     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
[MonoDroid]     at mono.android.TypeManager.n_activate(Native Method)
[MonoDroid]     at mono.android.TypeManager.Activate(TypeManager.java:7)
[MonoDroid]     at mobiledox.android.SpaceMasterView.<init>(SpaceMasterView.java:29)
[MonoDroid]     at java.lang.reflect.Constructor.constructNative(Native Method)
[MonoDroid]     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
[MonoDroid]     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
[MonoDroid]     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
[MonoDroid]     at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
[MonoDroid]     at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
[MonoDroid]     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
[MonoDroid]     at mobiledox.android.views.SpaceView.n_onCreate(Native Method)
[MonoDroid]     at mobiledox.android.views.SpaceView.onCreate(SpaceView.java:29)
[MonoDroid]     at android.app.Activity.performCreate(Activity.java:4469)
[MonoDroid]     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
[MonoDroid]     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
[MonoDroid]     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
[MonoDroid]     at android.app.ActivityThread.access$600(ActivityThread.java:127)
[MonoDroid]     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
[MonoDroid]     at android.os.Handler.dispatchMessage(Handler.java:99)
[MonoDroid]     at android.os.Looper.loop(Looper.java:137)
[MonoDroid]     at android.app.ActivityThread.main(ActivityThread.java:4507)
[MonoDroid]     at java.lang.reflect.Method.invokeNative(Native Method)
[MonoDroid]     at java.lang.reflect.Method.invoke(Method.java:511)
[MonoDroid]     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
[MonoDroid]     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
[MonoDroid]     at dalvik.system.NativeStart.main(Native Method)
[MonoDroid] Caused by: java.lang.ClassNotFoundException: Mvx.MvxListView
[MonoDroid]     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
[MonoDroid]     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
[MonoDroid]     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
[MonoDroid]     at android.view.LayoutInflater.createView(LayoutInflater.java:552)
[MonoDroid]     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
[MonoDroid]     ... 30 more
[mono-rt] Stacktrace:
[mono-rt] 
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) object.wrapper_native_0x40953d0d (intptr,intptr,intptr,intptr) <IL 0x00028, 0xffffffff>
[mono-rt]   at (wrapper delegate-invoke) <Module>.invoke_intptr__this___intptr_intptr_intptr_intptr (intptr,intptr,intptr,intptr) <IL 0x00063, 0xffffffff>
[mono-rt]   at Android.Runtime.JNIEnv.CallNonvirtualObjectMethod (intptr,intptr,intptr) [0x00060] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/0deb0164/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:521
[mono-rt]   at Java.Lang.Object.ToString () [0x0005a] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/0deb0164/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Java.Lang.Object.cs:200
[mono-rt]   at (wrapper runtime-invoke) <Module>.runtime_invoke_object__this__ (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception) <IL 0x00021, 0xffffffff>
[mono-rt]   at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception) <IL 0x00001, 0x00043>
[mono-rt]   at (wrapper dynamic-method) object.968f7a14-2e1a-4096-a88d-780b84872f1d (intptr,intptr,intptr) <IL 0x00026, 0x0005f>
[mono-rt]   at (wrapper native-to-managed) object.968f7a14-2e1a-4096-a88d-780b84872f1d (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>
[mono-rt] 
[mono-rt] =================================================================
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries 
[mono-rt] used by your application.
[mono-rt] =================================================================
[mono-rt] 

1 个答案:

答案 0 :(得分:0)

我认为你必须使用没有命名空间缩写的MvxListView:

<MvxListView xmlns:android="http://schemas.android.com/apk/res/android"..