我要显示一个下拉的性别选择。我通过一个字符串数组
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"