Designing layout using CardView


The material design has simplified creating CardView in Android. A new view was introduced through the support v7 library as a CardView. It can be used in many ways to display cards in android.

e.g, it can be used like an independent view to show floating search bar on top of the screen also it can be used to display cards in a list.
This widget can be used to display a card sort of a layout in android. Mostly it displays views on top of each other, with shadows. Simply we can say, Android CardView is such a view which has all material design properties, most importantly showing shadows according to the elevation.
CardView extends the FrameLayout class and lets you show information inside cards that have a consistent look across the platform.
CardView Appearance:


Some of the features of CardView:

1) Overlapping corners:

It has rounded corners. It clips the corners of content automatically. API 21 and above as the clipping is automatically done.Use the card_view:cardCornerRadius attribute.

2) CardView Content Padding:

When a card is displayed on the screen, usually we add multiple views on it. Android CardView supports this property to set the padding for CardView content, which can be set once and for all. we don’t need to set margin or padding for each view inside the CardView individually.

3) CardView Elevation:

This property defines the elevation of CardView. This is the core concepts of Android material design. According to the elevation defined, Android system dynamically shows the shadow of any material on the screen.

CardView uses elevation property on L for shadows and falls back to a custom shadow implementation on older platforms.
4) CardView Background Color:

To set the background color of a card, use the cardView:cardBackgroundColor attribute.
Add Dependencies:


Have a look on complete code:


. . .

Leave a comment


We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

Markus Walter

Markus Walter

Founder, Das Apartment Living

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home