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>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容