OnItemSelectedListener

OnItemSelectedListener

本文介绍了为什么OnItemSelectedListener仅称为当一个项目的变化,而不是在每个用户的选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Android应用程序微调控件,而我处理通过 onItemSelectedListener()法用户选择。这似乎在从目前的一个不同的选择工作好。我想,在一定条件下,可以将所有微调器默认值,并确保 onItemSelectedListener()被称为所有。

I'm using spinner controls in an Android application, and I handle user selections via an onItemSelectedListener() method. This seems to work okay when a different selection from the current one is made. I would like, under certain conditions to reset all spinners to default values and ensure that onItemSelectedListener() is called for all.

它是Android的语义的一部分onItemSelectedListener()只调用时用户选择更改。有没有办法强制 onItemSelectedListener()被称为?

Is it part of Android's semantics that onItemSelectedListener() is only called when user selection changes. Is there a way to force onItemSelectedListener() to be called?

推荐答案

默认当您选择相同的项目作为您的当前选定的项目微调不会触发任何事件。你需要做一个自定义的微调,以做到这一点。见How我可以在Android的微调得到的事件再次选择当前选定的项目?

The default Spinner doesn't trigger any event when you select the same item as your currently selected item. You will need to make a custom Spinner in order to do this. See How can I get an event in Android Spinner when the current selected item is selected again?

这篇关于为什么OnItemSelectedListener仅称为当一个项目的变化,而不是在每个用户的选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 18:33