开发者

Is there a workaround to the OnItemSelectedListener bug?

I suspect the answer is no, but thought I'd ask...

I have a Spinner that needs to reveal a hidden "proceed" button when the user has made a selection. However, since the OnItemSelectedListener is fired when the spinner is first rendered, and since it doesn't fire again when the user re-selects the item that is already highlighted, there doesn't appear to be a way to use this event to reveal a hidden button (or really do anything) contingent on the user having made a selection.

Is there some alternative way to do this? AdapterView has a ClickListener which just throws an exception, so that's a non-starter. And it doesn't seem to have any other notification scheme for when the user first makes contact with it, or when it closes... unless I'm missing something? (开发者_JS百科wouldn't be the first time).

All help appreciated.


I have a Spinner that needs to reveal a hidden "proceed" button when the user has made a selection.

The user has always made a selection. There is no concept of a Spinner without a selection. Hence, do not hide the "proceed" button.


I know that this isn't a solution, per se, but from the sound of things, it is a requirement that the user select SOMETHING to be allowed to continue, correct? What if you add, as the first item in the spinner, an unrelated item, saying something like "Please Select One..."? Have that as the default chosen item, then the user will have to make a different selection to continue, hence, the listener will be fired.

Just a thought. :)


I've seen in an few answer here on stackoverflow that onNothingSelected will enable you to detect this.

That answer was the only one and wasn't accepted, and I haven't tried it myself, but give it a go and see what happens.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜