material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[MaterialCardView] Card content should be clipped when shapeCornerFamily = cut

Open pubiqq opened this issue 2 years ago • 2 comments

shapeCornerFamily = rounded
(correct behavior)
shapeCornerFamily = cut
(incorrect behavior)

Material Library version: 1.7.0-alpha03

Device: Pixel 4 API 31

pubiqq avatar Jul 22 '22 14:07 pubiqq

FYI we have a duplicate report/request before: https://github.com/material-components/material-components-android/issues/1950

I'll try to see if the latest suggestion posted in that issue works. : ) (It may have certain API level restrictions, not sure.)

drchen avatar Jul 22 '22 19:07 drchen

I don't think it's a duplicate.

In #1950, the author asks that the card "be cut from all corners without clipping the content". Maybe there was some problem with this before, but now he can set the paddings for the content using the setContentPadding method.

In this issue, I ask that cut clip the content by default, just like rounded does, because the current behavior of MaterialCardView with cut is confusing; it differs from the behavior of other Material views, setContentPadding stops working as a method that "sets the padding between the Card's edges and the children of CardView", and if cornerFamily is cut, there is no way to create a card with image content in Material style without using various tricks.

Examples of cards with image content

pubiqq avatar Jul 25 '22 16:07 pubiqq