我如何做一个微调的"禁用"国家照看残疾? [英] How do I make a Spinner's "disabled" state look disabled?

查看:104
本文介绍了我如何做一个微调的"禁用"国家照看残疾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我禁用我的微调,它看起来几乎完全一样它没有之前被禁用,即

When I disable my Spinner it looks almost exactly like it did prior to being disabled, i.e.

之后

有残疾等功能一切都很好,但我想它的禁用。这个问题似乎已经被问了一圈陷阱( <一个href="http://stackoverflow.com/questions/2456069/how-to-grey-out-spinner-in-android">here 这里 作为实例),但最接近的人是来回答是 ,这似乎不完整我不明白呢?!?

It is disabled and so functionally everything is fine but I'd like it to look disabled. This question appears to have been asked around the traps (here and here for instance) but the closest anyone's come to an answer is this, which appears incomplete and I don't understand anyway?!?

<一个href="http://stackoverflow.com/questions/2456069/how-to-grey-out-spinner-in-android/2456733#2456733">Romain说 这是将起固定在升级Froyo,但我使用蜂窝,你可以从截图看,它似乎并没有工作。任何意见将是AP preciated。

Romain said it was to be fixed in Froyo onwards but I'm using Honeycomb and as you can see from the screenshots, it doesn't appear to work. Any advice would be appreciated.

推荐答案

不知道你还需要这一点,但有一种方法。我一直在努力奋斗着这个问题我自己。最后我做这样的事情:

Don't know if you still need this but there is a way. I've been struggling with this issue myself. I ended up doing something like this:

((Spinner) spinner).getSelectedView().setEnabled(false);
spinner.setEnabled(false);

这是什么实际上做是禁用的微调和显示所选择的项目。最有可能选择的项目是 TextView的并应显示为已禁用的TextView

What this actually does is disable the spinner and the selected item that is shown. Most likely the selected item is a TextView and it should show as a disabled TextView.

我使用这个和它的作品。但由于某些原因未知对我来说,并不像灰色的其他残疾的看法。它看起来仍然禁用虽然。试试吧。

I am using this and it works. But for some reason unknown to me it is not as "greyed-out" as other disabled views. It still looks disabled though. Try it out.

这篇关于我如何做一个微调的&QUOT;禁用&QUOT;国家照看残疾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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