Android的 - 设置微调器的默认值设置为null设置为、默认值、Android、null

2023-09-12 03:38:14 作者:戒爱ing

我试图让一个微调加载了没有选择的值。当用户选择一个值,然后又把他们到另一个页面。

这被证明是一个问题,因为在present,页面只是加载用户得到一个选择,选择之前立竿见影。

我的喷丝类是安装相同的方式Google的:http://developer.android.com/resources/tutorials/views/hello-spinner.html

因此​​,基本上,是有可能有一个微调框什么也没有,因为在present选择加载,加载在我的字符串数组的第一个项目。

谢谢大家

解决方案   

是有可能有一个微调,与没有选择加载

只有当没有数据。如果你有1 +项目在 SpinnerAdapter 微调将永远有一个选择。

纱厂不是设计成命令小部件。用户将不能指望在微调选择开始一个活动。请考虑使用,而不是微调。

修改

顺便说一句,我忘了提 - 你可以随时把你的适配器一个额外的条目重新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.