MvvmCross:MvxListView与模板错误

时间:2014-02-21 00:31:55

标签: android mvvmcross

我正在尝试使用带有MvxListView的模板,但是我收到以下错误:

    mvx:Warning: 21.13 using Inflate with a null parent viewGroup is discouraged - see https://github.com/MvvmCross/MvvmCross/issues/507
    [0:] mvx:Warning: 21.13 using Inflate with a null parent viewGroup is discouraged - see https://github.com/MvvmCross/MvvmCross/issues/507
    02-21 13:23:05.146 I/mono-stdout(30059): mvx:Warning: 21.13 using Inflate with a null parent viewGroup is discouraged - see https://github.com/MvvmCross/MvvmCross/issues/507
An unhandled exception occured.

ListView在没有模板的情况下工作正常,显示每个列表项的ToString。

我跟踪了错误中的链接并且担心Android 4.4引用,因为我运行的是带有4.4的Nexus 4,因此我下载并运行了KittenView源,但工作正常。

这是视图

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    style="@style/Layout">
    <include
        android:id="@+id/header"
        layout="@layout/PageHeader" />
    <include
        android:id="@+id/footer"
        layout="@layout/CancelFooter" />
    <LinearLayout
        style="@style/Layout"
        android:layout_below="@id/header"
        android:layout_above="@id/footer">
        <TextView
            style="@style/Text.Title"
            android:text="Add New Job" />
        <Mvx.MvxListView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          local:MvxBind="ItemsSource JobTypes"
          local:MvxItemTemplate="@layout/jobtype_item" 
          /> 
    </LinearLayout>
</RelativeLayout>

和模板

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
  <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    local:MvxBind="Text Description" />
</LinearLayout>

任何想法?

更新

看起来膨胀错误是一个红色的鲱鱼 - 当没有模板且没有崩溃时,我也得到了这个错误。似乎与缺少layout_width有关。

以下是完整的崩溃异常:

02-21 14:22:48.990 I/MonoDroid( 6664): UNHANDLED EXCEPTION: Java.Lang.RuntimeException: Exception of type 'Java.Lang.RuntimeException' was thrown.
02-21 14:22:48.990 I/MonoDroid( 6664): at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00064] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.2-branch/4b53fbd0/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:194
02-21 14:22:48.990 I/MonoDroid( 6664): at Android.Views.LayoutInflater.Inflate (int,Android.Views.ViewGroup,bool) [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.2-branch/4b53fbd0/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Views.LayoutInflater.cs:609
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.BindingContext.MvxAndroidBindingContext.CommonInflate (int,Android.Views.ViewGroup,Cirrious.MvvmCross.Binding.Droid.Binders.IMvxLayoutInfactorFactory,bool) <IL 0x00046, 0x00287>
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.BindingContext.MvxAndroidBindingContext.BindingInflate (int,Android.Views.ViewGroup,bool) <IL 0x00015, 0x00107>
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.BindingContext.MvxAndroidBindingContext.BindingInflate (int,Android.Views.ViewGroup) <IL 0x00004, 0x00063>
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.Views.MvxListItemView..ctor (Android.Content.Context,Cirrious.MvvmCross.Binding.Droid.Views.IMvxLayoutInflater,object,int) <IL 0x0001a, 0x000cf>
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.CreateBindableView (object,int) <IL 0x00013, 0x000bb>
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.GetBindableView (Android.Views.View,object,int) <IL 0x00027, 0x0027f>
In mgmain JNI_OnLoad
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup,int) <IL 0x00028, 0x0015f>
02-21 14:22:48.990 I/MonoDroid( 6664): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup) <IL 0x0001d, 0x00143>
02-21 14:22:48.990 I/MonoDroid( 6664): at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (intptr,intptr,int,intptr,intptr) [0x0001a] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.2-branch/4b53fbd0/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Widget.BaseAdapter.cs:460
02-21 14:22:48.990 I/MonoDroid( 6664): at (wrapper dynamic-method) object.b848e0e4-b229-42ef-800c-15bdfcb46936 (intptr,intptr,int,intptr,intptr) <IL 0x00023, 0x0005f>
02-21 14:22:48.990 I/MonoDroid( 6664): 
02-21 14:22:48.990 I/MonoDroid( 6664):   --- End of managed exception stack trace ---
02-21 14:22:48.990 I/MonoDroid( 6664): java.lang.RuntimeException: Binary XML file line #1: You must supply a layout_width attribute.
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:492)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5948)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6117)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.FrameLayout$LayoutParams.<init>(FrameLayout.java:615)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:559)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:56)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.LayoutInflater.inflate(LayoutInflater.java:480)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
02-21 14:22:48.990 I/MonoDroid( 6664):  at cirrious.mvvmcross.binding.droid.views.MvxAdapter.n_getView(Native Method)
02-21 14:22:48.990 I/MonoDroid( 6664):  at cirrious.mvvmcross.binding.droid.views.MvxAdapter.getView(MvxAdapter.java:91)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.AbsListView.obtainView(AbsListView.java:2263)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.ListView.makeAndAddView(ListView.java:1790)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.ListView.fillDown(ListView.java:691)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.ListView.fillFromTop(ListView.java:752)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.ListView.layoutChildren(ListView.java:1616)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.AbsListView.onLayout(AbsListView.java:2091)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.View.layout(View.java:14817)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.View.layout(View.java:14817)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.View.layout(View.java:14817)
02-21 14:22:48.990 I/MonoDroid( 6664):  at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:48.990 I/MonoDroid( 6664):  at
02-21 14:22:49.130 W/dalvikvm( 6664): JNI WARNING: JNI function GetMethodID called with exception pending
02-21 14:22:49.130 W/dalvikvm( 6664):              in Lcirrious/mvvmcross/binding/droid/views/MvxAdapter;.n_getView:(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View; (GetMethodID)
02-21 14:22:49.130 W/dalvikvm( 6664): Pending exception is:
02-21 14:22:49.130 I/dalvikvm( 6664): java.lang.RuntimeException: Binary XML file line #1: You must supply a layout_width attribute.
02-21 14:22:49.130 I/dalvikvm( 6664):   (raw stack trace not found)
02-21 14:22:49.130 I/dalvikvm( 6664): "main" prio=5 tid=1 NATIVE
02-21 14:22:49.130 I/dalvikvm( 6664):   | group="main" sCount=0 dsCount=0 obj=0x417b9ca8 self=0x417a83c8
02-21 14:22:49.130 I/dalvikvm( 6664):   | sysTid=6664 nice=0 sched=0/0 cgrp=apps handle=1074610516
02-21 14:22:49.130 I/dalvikvm( 6664):   | state=R schedstat=( 0 0 0 ) utm=337 stm=66 core=0
02-21 14:22:49.150 I/dalvikvm( 6664):   #00  pc 0000132e  /system/lib/libcorkscrew.so (unwind_backtrace_thread+29)
02-21 14:22:49.150 I/dalvikvm( 6664):   #01  pc 00060652  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+33)
02-21 14:22:49.150 I/dalvikvm( 6664):   #02  pc 00054640  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+395)
02-21 14:22:49.150 I/dalvikvm( 6664):   #03  pc 000546ae  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
02-21 14:22:49.150 I/dalvikvm( 6664):   #04  pc 00038804  /system/lib/libdvm.so
02-21 14:22:49.150 I/dalvikvm( 6664):   #05  pc 00040c80  /system/lib/libdvm.so
02-21 14:22:49.150 I/dalvikvm( 6664):   at cirrious.mvvmcross.binding.droid.views.MvxAdapter.n_getView(Native Method)
02-21 14:22:49.150 I/dalvikvm( 6664):   at cirrious.mvvmcross.binding.droid.views.MvxAdapter.getView(MvxAdapter.java:91)
02-21 14:22:49.150 I/dalvikvm( 6664):   at android.widget.AbsListView.obtainView(AbsListView.java:2263)
02-21 14:22:49.150 I/dalvikvm( 6664):   at android.widget.ListView.makeAndAddView(ListView.java:1790)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.widget.ListView.fillDown(ListView.java:691)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.widget.ListView.fillFromTop(ListView.java:752)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.widget.ListView.layoutChildren(ListView.java:1616)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.widget.AbsListView.onLayout(AbsListView.java:2091)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.view.View.layout(View.java:14817)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
02-21 14:22:49.160 I/dalvikvm( 6664):   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.view.View.layout(View.java:14817)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.view.View.layout(View.java:14817)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.view.View.layout(View.java:14817)
02-21 14:22:49.170 I/dalvikvm( 6664):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.view.View.layout(View.java:14817)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.view.View.layout(View.java:14817)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
02-21 14:22:49.180 I/dalvikvm( 6664):   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.view.Choreographer.doFrame(Choreographer.java:544)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.os.Handler.handleCallback(Handler.java:733)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.os.Handler.dispatchMessage(Handler.java:95)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.os.Looper.loop(Looper.java:136)
02-21 14:22:49.190 I/dalvikvm( 6664):   at android.app.ActivityThread.main(ActivityThread.java:5017)
02-21 14:22:49.190 I/dalvikvm( 6664):   at java.lang.reflect.Method.invokeNative(Native Method)
02-21 14:22:49.200 I/dalvikvm( 6664):   at java.lang.reflect.Method.invoke(Method.java:515)
02-21 14:22:49.200 I/dalvikvm( 6664):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
02-21 14:22:49.200 I/dalvikvm( 6664):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-21 14:22:49.200 I/dalvikvm( 6664):   at dalvik.system.NativeStart.main(Native Method)
02-21 14:22:49.200 I/dalvikvm( 6664): 
02-21 14:22:49.200 E/dalvikvm( 6664): VM aborting
02-21 14:22:49.200 E/mono-rt ( 6664): Stacktrace:
02-21 14:22:49.200 E/mono-rt ( 6664): 
02-21 14:22:49.200 E/mono-rt ( 6664):   at <unknown> <0xffffffff>
02-21 14:22:49.200 E/mono-rt ( 6664):   at (wrapper managed-to-native) object.wrapper_native_0x41551c59 (intptr,intptr,string,string) <IL 0x0004c, 0xffffffff>
02-21 14:22:49.210 E/mono-rt ( 6664):   at (wrapper delegate-invoke) <Module>.invoke_intptr__this___intptr_intptr_string_string (intptr,intptr,string,string) <IL 0x00063, 0xffffffff>
02-21 14:22:49.210 E/mono-rt ( 6664):   at Android.Runtime.JNIEnv.GetMethodID (intptr,string,string) [0x00042] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.2-branch/4b53fbd0/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:157
02-21 14:22:49.210 E/mono-rt ( 6664):   at Java.Lang.Throwable.get_Message () [0x00014] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.2-branch/4b53fbd0/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Java.Lang.Throwable.cs:231
02-21 14:22:49.210 E/mono-rt ( 6664):   at (wrapper runtime-invoke) <Module>.runtime_invoke_object__this__ (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
02-21 14:22:49.210 E/mono-rt ( 6664):   at <unknown> <0xffffffff>
02-21 14:22:49.210 E/mono-rt ( 6664):   at (wrapper dynamic-method) object.b848e0e4-b229-42ef-800c-15bdfcb46936 (intptr,intptr,int,intptr,intptr) <IL 0x00041, 0x000ec>
02-21 14:22:49.210 E/mono-rt ( 6664):   at (wrapper native-to-managed) object.b848e0e4-b229-42ef-800c-15bdfcb46936 (intptr,intptr,int,intptr,intptr) <IL 0x00028, 0xffffffff>
02-21 14:22:49.210 E/mono-rt ( 6664): 
02-21 14:22:49.210 E/mono-rt ( 6664): =================================================================
02-21 14:22:49.210 E/mono-rt ( 6664): Got a SIGABRT while executing native code. This usually indicates
02-21 14:22:49.210 E/mono-rt ( 6664): a fatal error in the mono runtime or one of the native libraries 
02-21 14:22:49.210 E/mono-rt ( 6664): used by your application.
02-21 14:22:49.210 E/mono-rt ( 6664): =================================================================
02-21 14:22:49.210 E/mono-rt ( 6664): 

0 个答案:

没有答案