在机器人的微调显示默认值 [英] Show default value in Spinner in android
本文介绍了在机器人的微调显示默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要显示一个下拉的性别选择。我通过一个字符串数组
I want to show a dropdown for gender selection. I passed a string array as
String arr[]=new String[]{"male","female"};
但问题是与价值男性
显示默认的选择,我想告诉性别
为默认值。如果我通过性别,在数组中的位置0,那么它在下拉也是可见的。我只是想性别作为提示,但它不能在下拉列表中显示。
but the problem is that is shows default selection with the value of "male"
and I want to show "Gender"
as default value. If I pass "Gender" in array at position 0, then it is visible in dropdown also. I just want "Gender" as hint but it must not be shown in dropdown.
谁能告诉我怎样才能做到这一点。先谢谢了。
Can anybody tell me how I can do this. Thanks in advance.
推荐答案
您可以设置提示微调...可在与Android的XML设置:提示=性别
You can set prompt to the spinner ... that can be set in the xml with android:prompt="Gender"
这篇关于在机器人的微调显示默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文