开发者

Android spinner does not trigger when "preselected item" is selected

I use two spinners filled from my database. When I select an item in one of these spinners, it sorts a ListView from what I selected.

The problem is that if I select the item that is already "preselected" by the spinner, it doesn't do anything (it seems that it doesn't go in the OnItemSelectedListener).

If I choose another item and, after that, I choose the item that was preselected by the spinner at the beginning, it works.

I found this in anoher question :

It is probably because the first item is ALREADY selected 
- if you want to add开发者_开发知识库 an option to represent that nothing is selected, 
you should add that to the head of your list.

But I'm suprised. Is it the only solution?


This is normal in most UI situations, if something is preselected, selecting it again doesn't fire an event.

Depending on what the selection should do, you could automatically call it when the item is preselected, saving the user a couple of taps, but it all depends on what you are actually doing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜