CardView在安卓5.0以下的坑

最近做項目用到了新控件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>
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容