醒目微调项目点击时没有列出只有一个项目 [英] Catching spinner item click when there is only one item listed

查看:190
本文介绍了醒目微调项目点击时没有列出只有一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一些不是为特制的微调。我拿到名单动态改变。我需要赶上onSelectedItemClick当用户的动产的项目。当只有一个在微调适配器项,则会出现问题。选择它(或者说重新选择,因为它已经被选中),将不会触发OnSelectedItemListener。

I'm trying to do something which wasn't the spinner specially made for. I got list that changes dynamically. I need to catch onSelectedItemClick when the user choses the item. Problem occurs when there is only one item in the spinner adapter. Selecting it (or rather reselecting, since it was selected already) won't fire OnSelectedItemListener.

我怎么能抓住它,否则?

How could I catch it otherwise?

推荐答案

如果你只有一个项目,然后无需从微调选择,你可以在 onSeletedItem方法。

if you have only one item then no need to choose from spinner and you can get in onSeletedItem method.


  • 如果你只有一个项目,然后onItemSelected也被称为。

字符串str =(字符串)parent.getSeletedItem();

这篇关于醒目微调项目点击时没有列出只有一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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