最近做項目用到了新控件CardView,結果發現安卓4.4的情況下出現這樣的情況
image.png
很明顯的坑爹,,,,
后來查找資料發現,在CardView添加以下屬性代碼即可(app:cardPreventCornerOverlap="false"):
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24px"
android:layout_marginRight="24px"
android:elevation="6px"
app:cardCornerRadius="10px"
app:cardPreventCornerOverlap="false">
然而更坑爹的來了,背景的藍色尖角居然把cardview的圓角給擋住了。。。。。
沒辦法,只能把藍色背景的樣式加上圓角
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="0"
android:endColor="#32b4ff"
android:startColor="#32ccff" />
<corners
android:bottomLeftRadius="10px"
android:topLeftRadius="10px" />
</shape>