Android的微调:当用户退出微调留下选择的值,是如何捕捉? [英] Android Spinner: How to catch when user exits spinner leaving selected value as-is?

查看:129
本文介绍了Android的微调:当用户退出微调留下选择的值,是如何捕捉?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个微调来了,它通常有一个价值preselected。如果用户明确选择其他项目,我onClickItem处理程序获取调用。但我没有找到一种方法,当用户希望保持当前选定的list_item可为的就是能检测?用户应该如何退出这样的微调时,他们喜欢现在的价值?你能添加一个关闭按钮或东西,只是让他们退出,而无需重新选择已选定的项目退出?此外,如果他们重新选择同一项目,你怎么发现的?我不认为我的处理程序也越来越要求这一点。

When a spinner comes up, it usually has a value preselected. If the users explicitly selects another item, my onClickItem handler is getting called. But i did not find a way to detect when the user wants to keep the the currently selected list_item as is? How is the user supposed to exit such a spinner when they like the current value? Could you add a close button or something to just let them exit without having to reselect the already selected item to exit? Also if they do reselect same item, how do you detect this? I don't think my handlers are getting called for this.

需要明确的是,我需要知道两件事情:

To be clear I need to know two things:

1),当用户希望保持当前值他们如何退出的微调?通过重新选择已经选择的产品吧。如果是这样的话,我怎么发现这个在code,所以我可以关闭对话框?

1) when user want to keep current value how do they exit the spinner? Is it by reselecting the already selected item. If this is the case, how do I detect this in code so I can close out the dialog?

2)是否有任何其他选项,让用户关闭了微调,而不需要重新选择已经选择的价值?例如提供一个对话框关闭按钮?想知道别人是怎么处理这一点。谢谢

2) are there any other options for letting user close out a spinner without having them reselect the already selected value? for example providing a dialog close button? Would like to know how others are handling this. Thanks

推荐答案

用户可以通过pressing硬件返回键退出微调的对话框。这是最关键的是什么 - 背出的活动和对话。如果当前选择的项目被选中,也退出微调的对话框。有一般不需要特殊处理,允许取消选择,因为用户可以直接退出微调对话框不做任何选择。

The user can exit the spinner's dialog by pressing the hardware back key. That's what the key is for - to back out of activities and dialogs. If the currently selected item is selected, that also exits the spinner's dialog. There's generally no need for special handling to allow cancelling the selection, since the the user can directly exit the spinner dialog without making a selection.

这篇关于Android的微调:当用户退出微调留下选择的值,是如何捕捉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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