Android的 - 设置微调器的默认值设置为null [英] Android - Set Spinner Default Value to null
问题描述
我试图让一个微调加载了没有选择的值。当用户选择一个值,然后又把他们到另一个页面。
这被证明是一个问题,因为在present,页面只是加载用户得到一个选择,选择之前立竿见影。
我的喷丝类是安装相同的方式Google的:<一href="http://developer.android.com/resources/tutorials/views/hello-spinner.html">http://developer.android.com/resources/tutorials/views/hello-spinner.html
因此,基本上,是有可能有一个微调框什么也没有,因为在present选择加载,加载在我的字符串数组的第一个项目。
谢谢大家
是有可能有一个微调,与没有选择加载
只有当没有数据。如果你有1 +项目在 SpinnerAdapter
的微调
将永远有一个选择。
纱厂
不是设计成命令小部件。用户将不能指望在微调
选择开始一个活动。请考虑使用,而不是微调别的东西,就像一个
的ListView
或的GridView
, code>。
修改
顺便说一句,我忘了提 - 你可以随时把你的适配器一个额外的条目重新presents无选择,并使其初步选定的项目在微调
。
I'm trying to get a Spinner to load up with no selected value. once the user selects a value it then takes them to another page.
This is proving to be a problem because at present, the page just loads straight away before the user gets a choice to choose.
My spinner class is setup the same way as googles: http://developer.android.com/resources/tutorials/views/hello-spinner.html
So basically, is it possible have a spinner that loads with nothing selected because at present, it loads the first item in my string array.
Thanks Everyone
is it possible have a spinner that loads with nothing selected
Only if there is no data. If you have 1+ items in the SpinnerAdapter
, the Spinner
will always have a selection.
Spinners
are not designed to be command widgets. Users will not expect a selection in a Spinner
to start an activity. Please consider using something else, like a ListView
or GridView
, instead of a Spinner
.
EDIT
BTW, I forgot to mention -- you can always put an extra entry in your adapter that represents "no selection", and make it the initial selected item in the Spinner
.
这篇关于Android的 - 设置微调器的默认值设置为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!