[英]How to disable android spinner without graying it out?
Hi all I am trying to show an Android spinner, but not show it as grayed out. 大家好,我试图显示一个Android微调器,但不显示为灰色。 I tried using setFocusable(false), which works fine on edit boxes, but not on spinners.
我试过使用setFocusable(false),它在编辑框上很好用,但在微调器上不能用。 I don't want the spinner to changeable unless I tell it to be.
除非我告诉我,否则我不希望微调器可变。 Basically I have a screen displaying data that I want to put in "update mode".
基本上,我有一个屏幕,显示要放入“更新模式”的数据。 Until the user has chosen to update the data, it should be view only.
在用户选择更新数据之前,应仅查看数据。 Any ideas?
有任何想法吗?
也许您可以创建一个自定义选择器并将其设置为微调器背景,请查看此链接以了解选择器
I ended up cheating a little. 我最终作弊了一点。 I got the background image before disabling the field, then set the background to that image after disabling the field.
在禁用该字段之前,我先获得了背景图片,然后在禁用该字段之后将背景设置为该图片。
// Deal with spinners. I don't want to gray out the background
// because it looks bad against our dark theme.
Drawable d = type.getBackground().getCurrent(); // the enabled background
type.setEnabled(enabled);
// set all of the spinners back to the enabled background
if(!enabled){
type.setBackgroundDrawable(d);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.