Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a Spinner's "disabled" state look disabled?

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

Before

enter image description here

After

enter image description 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?!?

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.

like image 908
MisterWeary Avatar asked Oct 03 '11 23:10

MisterWeary


1 Answers

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

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.

like image 200
Bandreid Avatar answered Oct 14 '22 15:10

Bandreid