Android的 - 设置微调器的默认值设置为null [英] Android - Set Spinner Default Value to null

查看:244
本文介绍了Android的 - 设置微调器的默认值设置为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屋!

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