Android change Material elevation shadow color

后端 未结 3 1177
[愿得一人]
[愿得一人] 2020-11-30 02:10

is it possible to change the shadow color produced by the xml elevation property? I want the shadow be dynamically changed by code.

3条回答
  •  长情又很酷
    2020-11-30 02:25

    Starting API 28 (Pie) View#setOutlineAmbientShadowColor(int color) and View#setOutlineSpotShadowColor(int color) are available in the View class.

    If you use elevation on your View, you can use both methods to change the color of the shadow.

提交回复
热议问题