难道setShadowLayer()上的一个按钮的工作? [英] Does setShadowLayer() work on a Button?

查看:177
本文介绍了难道setShadowLayer()上的一个按钮的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变一个按钮上的文本的阴影,我无法得到它的工作。

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?

谢谢了

推荐答案

此方法用于更改包含的按钮(也内的文本的影子,你应该低音android.R.color.black直接,它的ID黑色,而不是本身的颜色,请参阅参考资料类的更多信息。)

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.)

这篇关于难道setShadowLayer()上的一个按钮的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆