支持 CardView 的默认边距是多少,以便我可以根据自己的情况定义边距?
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
card_view:cardUseCompatPadding="true"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="2dp">
最佳答案
我也遇到了同样的问题。它没有工作,即使我添加了 android:layout_marginBottom
。
但我找到了解决方案。
您的 CardView 应该在 RelativeLayout 内。然后 android:layout_marginBottom
和 android:layout_marginTop
将按预期工作。
关于java - 如何定义 CardView 的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43525160/