问题
For card elevation to be visible, I use the attribute card_view:cardUseCompatPadding="true"
in cardview XML. It added extra padding on all four sides of the cardview, but I do not need the bottom padding since the card below every card will already have a top padding. So currently it is like double padding between two cards because of top+bottom padding. How to reduce it by half?
P.S android:layout_marginBottom="-5dp"
doesn't seem to work
回答1:
Only use a margin at the bottom for the cards and set a padding to the top of your RecyclerView/ListView holding the cards:
<android.support.v7.widget.RecyclerView
...
android:paddingTop="5dp"
android:clipToPadding="false" />
来源:https://stackoverflow.com/questions/34240078/modify-cardview-padding