Does setShadowLayer() work on a Button?
Asked Answered
D

1

1

I'm trying to change the drop shadow of the text in a button and I can't get it working.

I want to change the color based on the state of the button. I tried using a color selector for the shadow color but it crashed the app. It didn't seem to want to use a selector for that attribute. So, now I am trying to do it at run time using

button.setShadowLayer(1, 1, 1, android.R.color.black);

However, it doesn't change anything at all.

How can I get this to work?

Thanks much

Didactic answered 8/2, 2011 at 2:16 Comment(0)
P
4

This method is used to change the shadow on the text contained inside the button (also, you should bass android.R.color.black directly, it's the ID of the black color, not the color itself, see the Resources class for more info.)

Pantin answered 8/2, 2011 at 2:36 Comment(1)
Thanks Romain, I knew I was doing something stupid. I changed it to use Color.BLACK and now it is working as expected.Didactic

© 2022 - 2024 — McMap. All rights reserved.