setShadowLayer Android API differences

前端 未结 1 1390
傲寒
傲寒 2020-12-01 06:17

I develop a custom view component for my application and I am struggling with adding a shadow to a circle.

Here is the code of my class extending View



        
相关标签:
1条回答
  • 2020-12-01 07:06

    setShadowLayer() is only supported on text when hardware acceleration is on. Hardware acceleration is on by default when targetSdk=14 or higher. An easy workaround is to put your View in a software layer: myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null).

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