Search code examples
c#androidxamarin.android

CardView Design is not appear Xamarin Android


My CardView design is not properly appearing in Xamarin android project. It's gives me a alert "could not load controls form the android support library". Though I've added all support libraries. I really can't find the missing libraries now.

I've a imageview and some other textview under the CardView which is not appearing in design. but runs the project without having any issues.

Any help is highly appreciated.

[![Here is my design preview. It's just showing the text CardView][1]][1]

Here is the libraries enter image description here

enter image description here


Solution

  • I think your project may have migrated to AndroidX.

    Try to install Xamarin.AndroidX.CardView nuget package and use

    <androidx.cardview.widget.CardView>
        ...
    </androidx.cardview.widget.CardView>
    

    or install Xamarin.Google.Android.Material nuget package and use

    <com.google.android.material.card.MaterialCardView>
        ...
    </com.google.android.material.card.MaterialCardView>