Elevation on Android Lollipop not working

后端 未结 9 1526
长情又很酷
长情又很酷 2020-11-28 12:22

I am trying to make use of the elevation property in the latest Android Lollipop preview release. I set the targetSdk to 21 and the theme to Material. Next i added a backgro

相关标签:
9条回答
  • 2020-11-28 13:17

    For some reason if you set a solid color with a transparency, the elevation shadow does not show up.

    In your example, I changed #7d0073ff to #0073ff and I got a shadow.

    This is probably a bug, as in their documentation it gives a similar example using a translucent background color.

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

    ADDING android:elevation shadow to an ImageView:

    android:clipToPadding="false"
    +
    android:outlineProvider="bounds"
    +
    android:elevation="2dp"
    
    0 讨论(0)
  • 2020-11-28 13:22

    be aware, if you have the following line in the manifest then shadows wont show:

    android:hardwareAccelerated="false"

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