美文网首页
CardView兼容处理

CardView兼容处理

作者: 91b9ccc21580 | 来源:发表于2017-09-07 14:58 被阅读87次

    在低版本中设置了 CardElevation 之后 CardView 会自动留出空间供阴影显示
    Lollipop 之后则需要手动设置 Margin 边距来预留空间

    解决:

    app:cardUseCompatPadding="true"
    

    需要CardView点击带有系统默认ripple效果,添加属性:

    android:clickable="true"
    android:foreground="?attr/selectableItemBackground"
    

    http://www.jianshu.com/p/07097b562acb
    https://www.ctolib.com/changliugang-CardView.html

    相关文章

      网友评论

          本文标题:CardView兼容处理

          本文链接:https://www.haomeiwen.com/subject/oyeijxtx.html