我正在我的项目 Xamarin Android 和 Card View 中实现 Recycler View

I am implementing Recycler View in my project Xamarin Android and Card View

我正在实施 RecyclerView 和 CardView。 RecylerView 没有给出任何错误,但 CardView xml 向我显示此错误: 无法从 Android 支持库加载控件,执行 NuGet 还原可能会解决此问题。

<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:cardCornerRadius="8dp"
    android:scrollbarAlwaysDrawHorizontalTrack="false"
    android:scrollbars="horizontal|none">


    <RelativeLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#f8f8f8"
    >




        <ImageView
            android:src="@drawable/pothole1"
            android:layout_width="265dp"
            android:layout_height="197dp"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="140dp"
            android:id="@+id/imgIssue" />
        <ImageView
            android:layout_width="265dp"
            android:layout_height="197dp"
            
            android:layout_centerHorizontal="true"
            android:layout_marginTop="140dp"
            android:visibility="visible"
            
            android:scrollbars="horizontal"
            android:id="@+id/imageView1"
            android:scaleType="centerCrop"
            android:contentDescription="description"
            tools:ignore="MissingDimension,Suspicious0dp" />

        <ImageView
            android:src="@drawable/belowbg"
            android:layout_width="265dp"
            android:layout_height="251dp"
            android:layout_marginTop="313dp"
            android:layout_centerHorizontal="true"
            android:id="@+id/imgbelowPath"
         />
        <ImageView
            android:src="@drawable/profile"
            android:layout_width="150dp"
            android:layout_height="92dp"
            android:layout_marginTop="310dp"
            android:layout_marginStart="25dp"
            android:id="@+id/imgProfile"
         />
        <TextView
            android:text="Nabeel Khan"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/imgIssue"
            android:layout_marginTop="30dp"
            android:layout_marginStart="140dp"
            android:textSize="15dp"
            android:textColor="#fff"
            android:textStyle="normal"
            android:id="@+id/tvname" />

        <TextView
            android:text="24m"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/imgIssue"
            android:layout_marginStart="140dp"
            android:textSize="10dp"
            android:layout_marginTop="50dp"
            android:textColor="#fff"
            android:textStyle="normal"
            android:id="@+id/tvtime" />
        <ImageView
            android:src="@drawable/downbtn"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginStart="260dp"
            android:layout_below="@id/imgIssue"
            android:id="@+id/imgoptions"
            android:layout_marginTop="20dp"
         />


        <TextView
            android:text="Open Road Spill"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/imgIssue"
            android:textSize="20dp"
            
            android:layout_centerHorizontal="true"
            android:maxLines="3"
            android:layout_marginTop="85dp"
            android:layout_marginStart="100dp"
            android:layout_marginEnd="60dp"
            android:textColor="#fff"
            android:textStyle="normal"
            android:id="@+id/tvinfo" />





    </RelativeLayout>



</android.support.v7.widget.CardView>

我已经试过了:

  1. 恢复 NuGet 包。
  2. 更新所有 NuGet 包。
  3. Bin 和 Obj 删除。
  4. 构建和重建解决方案。

您可以尝试检查您的项目是否已经迁移到AndroidX

如果是,可以参考