CardView has extra margin in each edge on Pre-Lollipop

前端 未结 7 902
闹比i
闹比i 2020-12-24 14:05

Here are two pictures.

on Lollipop: \"on

on Pre-Lollipop:

7条回答
  •  余生分开走
    2020-12-24 14:45

    So here it goes perfectly fine on Kitkat, samsung device to be precise.

    I tried card_view:cardUseCompatPadding="true" but no avail. Didn't work!

    Then I discovered from a stackoverflow post this card_view:cardPreventCornerOverlap="false" and VOILA! Worked! There were no round corners (Since, I wanted none as the Card has an Image background).

    The moral is, an extra padding is because of those tiny round corners which, need to be disabled. Basically that is not a flaw rather a Design constraint!

    ORIGINAL SOF REPLY

    Image: Notice that top corners are edges (A view which has colour and an image in background) while bottom has just TextViews and no backgrounds hence, the round corners. That means if a view is requesting match_parent inside the CardView, card_view:cardPreventCornerOverlap="false" will allow that to be taken up, on the affected corners.

提交回复
热议问题