错误 - 找不到与给定名称匹配的资源(在'MvxItemTemplate'处,值为'@ layout / itemc')

时间:2013-12-19 10:17:17

标签: android xamarin mvvmcross

我正在使用MvvmCross创建PCL。在我的Android应用程序中,我创建了一个名为itemc.axml的ItemTemplate的mvx.mvxListView。 文件itemc.axml在Layout文件夹中创建,但仍然会出现此错误。 错误 - 找不到与给定名称匹配的资源('MvxItemTemplate',值为'@ layout / itemc')

为什么呢?

我的FirstView.axml文件如下

          <?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/constD.Droid"
                    android:orientation="vertical"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">
                    <Button
                             android:text="Show Constituencies"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:id="@+id/button1" />
                    <Mvx.MvxListView
                             android:layout_width="fill_parent"
                             android:layout_height="fill_parent"
                             local:MvxBind="ItemsSource Result"
                             local:MvxItemTemplate="@layout/itemc" />
             </LinearLayout>

和我的itemc.axml文件如下。

     <?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"
                      android:textSize="40dp"
                      local:MvxBind="Text name" />
    </LinearLayout>

为什么会这样?

2 个答案:

答案 0 :(得分:7)

尝试将文件itemc.axml重命名为Itemc.axml,看看是否有效

答案 1 :(得分:5)

在camelCase中命名时出现此错误。重命名为小写固定它。

相关问题