What’s the difference between the CardView from com.google.android.material and android.support.v7.widget

There are 3 versions:

  • android.support.v7.widget.CardView: it is provided by the old support libraries and it is deprecated.

  • androidx.cardview.widget.CardView it is the androidx version and it replaced the support libraries.
    To use it you have to add the dependency implementation 'androidx.cardview:cardview:x.x.x'.

  • com.google.android.material.card.MaterialCardView is provided by the Material Components Library.
    To use it you have to add the dependency implementation
    'com.google.android.material:material:1.1.0'.

The MaterialCardView extends the androidx.cardview.widget.CardView and
introduces some changes as the use of a MaterialShapeDrawable as background (it allows shaping and elevation overlays for Dark Themes).
Also MaterialCardView supports checking and dragging.

Leave a Comment