问题描述
我有一个字符串的二维数组。我想用一个微调,以允许用户从数组的第二个拉特选择价值观,但我想显示使用数组类的头一号拉特的值在expandablelistview选择的选项。
I have a 2d array of strings. I would like to use a spinner to allow users to select values from the 2nd lvl of the array but I would like to display the selection options in a expandablelistview using the values of the 1st lvl of the array as category headers.
这是可能的,可以有人指出我的这个应该怎么实现的正确方向?
Is this possible, can someone point me in the right direction of how this should be implemented ?
推荐答案
您不能直接使用 ExpandableListView
为微调
弹出,任何比你可以直接使用的ListView
为微调
弹出更多。这是它是什么,那就是由微调
类定义的。
You cannot directly use an ExpandableListView
for the Spinner
popup, any more than you can directly use a ListView
for the Spinner
popup. It is what it is, and that is defined by the Spinner
class.
选项包括:
- 子类化
微调
和压倒一切的一切推动弹出的对话框 - 复制
微调
到项目和更换任何驱动器弹出的对话框(如果压倒一切不会因方法知名度等工作。) - 请不要使用
微调
,而是使用按钮
加上AlertDialog含
的ExpandableListView
,或者类似的东西
- Subclassing
Spinner
and overriding whatever drives the popup dialog - Copying
Spinner
into your project and replacing whatever drives the popup dialog (if overriding will not work due to method visibility, etc.) - Don't use a
Spinner
, and instead use aButton
plus anAlertDialog
containing anExpandableListView
, or something like that
在原则上,你可以覆盖 getDropDownView()
在 SpinnerAdapter
(例如, ArrayAdapter
)。然而,没有下拉查看被禁用的概念,我想你想你的类头是不可选。然而,如果选择一个类别是可接受的,该方法将最简单的。
In principle, you could override getDropDownView()
in your SpinnerAdapter
(e.g., ArrayAdapter
). However, there is no concept of the drop-down view being disabled, and I assume you would want your category headers to be non-selectable. If, however, selecting a category is acceptable, this approach would be simplest.
这篇关于是有可能使用一个expandablelistview作为旋转器一个dropdownview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!