How to define margin of CardView

情到浓时终转凉″ 提交于 2019-12-04 09:45:32

How to define margin of CardView?

Use attribute android:layout_marginLeft, android:layout_marginRight, android:layout_marginTop and android:layout_marginBottom to define CardView margins.

What is the default margin of Support CardView?

Here is the CardView Documentation. Also see the Design Guidelines.

FYI, Use attribute card_view:cardUseCompatPadding="false" to remove inner padding inside CardView.

Anushka Madusanka

I also came up with the same problem. It didn't work even though I added android:layout_marginBottom .

But I found the solution. Your CardView should be inside the RelativeLayout. Then android:layout_marginBottom and android:layout_marginTop will work as expected.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!