我在RecyclerView中使用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"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:foreground="?android:selectableItemBackground">
根据android API文档,填充应该是
maxCardElevation * 1.5 + (1 - cos45) * cornerRadius
当我System.out.print maxElevation时,它是4.0,这导致~7.17的填充。但是,当我打开LayoutBounds时,很容易看到填充实际上甚至不是2 dp。
我正在尝试在列表中修复我的cardspacing但不知道真正的填充这是不可能的。
有没有人对此事有任何见解?
编辑:我在带有CyanogenMod11 M11的Nexus 4上运行它