CardView not showing Shadow in Android L

前端 未结 17 870
一生所求
一生所求 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:17

    check hardwareAccelerated in manifest make it true , making it false removes shadows , when false shadow appears in xml preview but not in phone .

    0 讨论(0)
  • 2020-11-28 03:17

    I think if you check your manifest first if you wrote android:hardwareAccelerated="false" you should make it true to having shadow for the card Like this answer here

    0 讨论(0)
  • My recyclerview was slow in loading so by reading the stackoverflow.com I changed hardwareAccelerated to "false" then the elevation is not showing in the device. The I changed back to true. It works for me.

    0 讨论(0)
  • 2020-11-28 03:19

    Do not forget that to draw shadow you must use hardwareAccelerated drawing

    hardwareAccelerated = true

    hardwareAccelerated = false

    See Android Hardware Acceleration for details

    0 讨论(0)
  • 2020-11-28 03:21

    move your "uses-sdk" attribute in top of the manifest like the below answer https://stackoverflow.com/a/27658827/1394139

    0 讨论(0)
提交回复
热议问题