Tutorial by Examples

CardView is a member of the Android Support Library, and provides a layout for cards. To add CardView to your project, add the following line to your build.gradle dependencies. compile 'com.android.support:cardview-v7:25.1.1' A number of the latest version may be found here In your layout you ...
CardView provides a default elevation and corner radius so that cards have a consistent appearance across the platforms. You can customize these default values using these attributes in the xml file: card_view:cardElevation attribute add elevation in CardView. card_view:cardBackgroundColor attr...
To enable the ripple animation in a CardView, add the following attributes: <android.support.v7.widget.CardView ... android:clickable="true" android:foreground="?android:attr/selectableItemBackground"> ... </android.support.v7.widget.CardView>
While using Image/Colour as an background in a CardView, You might end up with slight white paddings (If default Card colour is white) on the edges. This occurs due to the default rounded corners in the Card View. Here is how to avoid those margins in Pre-lollipop devices. We need to use an attribu...
public void setCardColorTran(CardView card) { ColorDrawable[] color = {new ColorDrawable(Color.BLUE), new ColorDrawable(Color.RED)}; TransitionDrawable trans = new TransitionDrawable(color); if(Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { card.setB...

Page 1 of 1