I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its backgroun
There are some advantages of cards over layouts, including:
All these and other features can be found in the card's design guideline.
In short:
CardView is google's way of styling RecyclerView. You can always use RelativeLayout or any other method prefered.
According to Google's design guidelines, definition of CardView is
Cards are a convenient means of displaying content composed of different elements. They’re also well-suited for showcasing elements whose size or supported actions vary, like photos with captions of variable length.
Using CardView, you get the default Google's look and feel throughout your app. You can customize cardview to your needs. That is why you need to have child layouts inside CardView. Plus Material Design is all about, elevation, colors and animation. CardView can have all these in a relatively easy manner.
It would be nice if you go through Google's design guide lines on CardView.