CardView not showing Shadow in Android L

前端 未结 17 943
一生所求
一生所求 2020-11-28 02:50

My Cardview inside Listview is not showing shadow in Android L(Nexus 5). Also the round edges are not properly shown. Here is the code for Listview\'s Adapter View :

17条回答
  •  情歌与酒
    2020-11-28 03:09

    Add this line to CardView....

    card_view:cardUseCompatPadding="true" //for enable shadow
    card_view:cardElevation="9dp" // this for how much shadow you want to show
    

    Tips

    You can avoid layout_marginTop and layout_marginBottom as shadow itself takes some space to the up and down of it.The amount space defined by how much you will use in card_view:cardElevation="ndp" .

    Happy Coding (:

提交回复
热议问题