MvvmCross / MvvmCross-AndroidSupport

Android support library packages for MvvmCross: The .NET MVVM framework for cross-platform solutions.
http://mvvmcross.com
15 stars 0 forks source link

No resource found that matches the given name (at 'MvxItemTemplate' #314

Closed edikep2000 closed 8 years ago

edikep2000 commented 8 years ago

Hi everyone.

I have an issue using the MvxRecyclerView in my android project . My Layout File is as follows

<?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:layout_width="match_parent"
android:layout_height="match_parent">
<MvvmCross.Droid.Support.V4.MvxSwipeRefreshLayout
        android:id="@+id/refresher"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        local:MvxBind="Refreshing Busy; RefreshCommand ReloadCommand">
        <MvxRecyclerView
            android:id="@+id/my_recycler_view"
            android:scrollbars="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            local:MvxItemTemplate="@layout/listitem_forumList"
            local:MvxBind="ItemsSource Forums; ItemClick NavigateTopicsCommand" />
    </MvvmCross.Droid.Support.V4.MvxSwipeRefreshLayout>
</LinearLayout>

and the listitem_forumList is contained in the following XML File

<?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="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:minHeight="60dp"
        android:orientation="horizontal"
        android:paddingLeft="10dp"
        android:paddingTop="10dp"
        android:paddingBottom="10dp">
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_marginLeft="5dp"
            android:src="@drawable/ic_reorder_black_24dp" />
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="10dp"
            android:layout_weight="1"
            android:orientation="vertical">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
                android:textColor="#424242"
                android:textStyle="normal"
                local:MvxBind="Text Name"/>
        </LinearLayout>
        <ImageView
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:background="?attr/selectableItemBackground"
            android:clickable="true"
            android:padding="13dp"
            android:src="@drawable/ic_chevron_right_black_24dp"
            android:tint="@color/grey_hard" />
    </LinearLayout>

</LinearLayout>

What I cannot understand is why compilation will always fail with the following message

No resource found that matches the given name (at 'MvxItemTemplate' with value '@layout/listitem_forumList'). I do see some warning messages like Severity Code Description Project File Line Suppression State Warning The 'http://schemas.android.com/apk/res-auto:MvxBind' attribute is not declared.
that I am missing

Cheesebaron commented 8 years ago

Android Resource names should all be lower case.

edikep2000 commented 8 years ago

Nope, I lowercased it all and it still did not work

kjeremy commented 8 years ago

Are you adding the assembly that contains MvxRecyclerView to your AndroidViewAssemblies in Setup.cs?

edikep2000 commented 8 years ago

I eventually deleted the entire content of the C:\Users\AppData\Local\Xamarin folder and rebuilt the project. Everything works fine from here onwards