我正在使用Mvvmcross在Xamarin中构建一个Android应用程序。在这个应用程序中,我需要一个F.a.q.页面,我需要一个listview。使用MvxListView我成功显示没有模板的项目。奇怪的是当我绑定MvxItemTemplate时,它没有编译给我错误。
找不到与给定名称匹配的资源(在' MvxItemTemplate'值为' @ layout / FaqCategoryLayout'。(APT0000)
绑定看起来像这样:
<LinearLayout
android:orientation="vertical"
android:id="@+id/Page"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:background="@android:color/white">
<Mvx.MvxListView
android:layout_width="match_parent"
android:layout_height="match_parent"
local:MvxItemTemplate="@layout/FaqCategoryLayout"
local:MvxBind="ItemsSource Collection"
/>
</LinearLayout>
这是布局
<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="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
local:MvxBind="Text Category"/>
</LinearLayout>
我在这个主题上看到了很多帖子,其中大部分都很容易修复。但它们都不适合我。我非常确定布局名称完全相同。此外,当我在按钮背景上使用相同的布局时,它会按照它应该进行编译。
答案 0 :(得分:2)
没关系。我是个白痴。我从列表视图中的mvvmcross n + 1重新录制了视频,并注意到一个重要的关键字:“小写”。
因此将ItemTemplate设置为小写确实可以解决问题
local:MvxItemTemplate="@layout/faqcategorylayout"