Attribute Name
Related Method
Description
android.support.v7.cardview:cardBackgroundColor
setCardBackgroundColor(int)
Background color for CardView.
android.support.v7.cardview:cardCornerRadius
setRadius(float)
Corner radius for CardView.
android.support.v7.cardview:cardElevation
setMaxCardElevation(float)
Elevation for CardView.
android.support.v7.cardview:cardMaxElevation
Maximum Elevation for CardView.
android.support.v7.cardview:cardPreventCornerOverlap
setPreventCornerOverlap(boolean)
Add padding to CardView on v20 and before to prevent intersections between the Card content and rounded corners.
android.support.v7.cardview:cardUseCompatPadding
setUseCompatPadding(boolean)
Add padding in API v21+ as well to have the same measurements with previous versions.
android.support.v7.cardview:contentPadding
setContentPadding(int,int,int,int)
Inner padding between the edges of the Card and children of the CardView.
android.support.v7.cardview:contentPaddingBottom
Inner padding between the bottom edge of the Card and children of the CardView.
android.support.v7.cardview:contentPaddingLeft
Inner padding between the left edge of the Card and children of the CardView.
android.support.v7.cardview:contentPaddingRight
Inner padding between the right edge of the Card and children of the CardView.
android.support.v7.cardview:contentPaddingTop
Inner padding between the top edge of the Card and children of the CardView.
返回值类型
方法/描述
float
getCardElevation()
Returns the backward compatible elevation of the CardView.
int
getContentPaddingBottom()
Returns the inner padding before the Card’s bottom edge
getContentPaddingLeft()
Returns the inner padding after the Card’s left edge
getContentPaddingRight()
Returns the inner padding before the Card’s right edge
getContentPaddingTop()
Returns the inner padding after the Card’s top edge
getMaxCardElevation()
boolean
getPreventCornerOverlap()
Returns whether CardView should add extra padding to content to avoid overlaps with rounded corners on API versions 20 and below.
getRadius()
Returns the corner radius of the CardView.
getUseCompatPadding()
Returns whether CardView will add inner padding on platforms L and after.
void
setCardBackgroundColor(int color)
Updates the background color of the CardView
setCardElevation(float radius)
Updates the backward compatible elevation of the CardView.
setContentPadding(int left, int top, int right, int bottom)
Sets the padding between the Card’s edges and the children of CardView.
setMaxCardElevation(float radius)
setPadding(int left, int top, int right, int bottom)
Sets the padding.
setPaddingRelative(int start, int top, int end, int bottom)
Sets the relative padding.
setPreventCornerOverlap(boolean preventCornerOverlap)
On API 20 and before, CardView does not clip the bounds of the Card for the rounded corners.
setRadius(float radius)
Updates the corner radius of the CardView.
setUseCompatPadding(boolean useCompatPadding)
CardView adds additional padding to draw shadows on platforms before L.