简体   繁体   English

Android获取主题颜色,禁用按钮

[英]Android get theme colors, disabled button

Is there a way to read current theme colors from code ? 有没有办法从代码中读取当前的主题颜色?

I want to 1. Read disabled Button color and put it as EditText background 2. Read Spinner selected item color and put it as TextView background 我想要1.读取禁用的按钮颜色并将其作为EditText背景2.读取Spinner所选项目的颜色并将其作为TextView背景

Read disabled Button color and put it as EditText background 读取禁用的按钮颜色并将其作为EditText背景

Disabled is not a color. 禁用不是颜色。 It is a state of a StateListDrawable that is used for the button background. 它是用于按钮背景的StateListDrawable的状态。 Hence, you cannot "read disabled Button color", because there is no simple color for "disabled". 因此,您无法“读取已禁用的按钮颜色”,因为没有简单的颜色可用于“已禁用”。

Read Spinner selected item color and put it as TextView background 读取微调框选择的项目颜色并将其作为TextView背景

The selected item in a Spinner has no specific color, as so therefore I have no idea what color you might mean here. Spinner ”中的选定项目没有特定的颜色,因此我不知道您在这里可能表示什么颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM