安卓:更改微调下拉视图 [英] Android: Change Spinner Dropdown view
问题描述
林我的应用程序,我想以下类型的微调下拉视图。 对于这种类型的离心器图。我写这篇code。
Im My application I want the below type of Spinner Dropdown view . For this type of spinner view. I wrote this code.
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.spinner, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner_obj.setAdapter(adapter);
我从<一个得到这个href="http://developer.android.com/guide/topics/ui/controls/spinner.html">http://developer.android.com/guide/topics/ui/controls/spinner.html 但我得到的是,
I got this from http://developer.android.com/guide/topics/ui/controls/spinner.html But what I got is,
请为我做到这一点的最好办法......
Please provide me the best way to do this....
推荐答案
类在这里恢复旧的文章,但接受的答案是远远不够理想。要做到这一点,正确的方法是设置微调器在布局XML下拉列表中方式:
Kind of reviving an old post here but the accepted answer is far from ideal. The correct way to do this is to set the Spinner to dropdown mode in your layout xml:
<Spinner
android:id="@+id/my_spinner"
...
android:spinnerMode="dropdown"/>
可用的选项是对话和下拉列表中。
The available options are "dialog" and "dropdown".
这篇关于安卓:更改微调下拉视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!