How to add cardview in layout xml in AndroidX
After upgraded to AndroidX
implementation com.google.android.material:material:1.0.0
to
implementation com.google.android.material:material:1.0.0-alpha1
it is download all design related class. its work for Me
Changes in : 1. build.gradle(:app)
dependencies {
...
implementation 'androidx.cardview:cardview:1.0.0'
....
}
2. in xml section:
<androidx.cardview.widget.CardView>
...
</androidx.cardview.widget.CardView>
I had the same problem in Android Studio 3.5.1. It worked for me:
def cardview_version = "1.0.0"
implementation "androidx.cardview:cardview:$cardview_version"
xmln: <androidx.cardview.widget.CardView>....