可能使用一个expandablelistview作为旋转器一个d

可能使用一个expandablelistview作为旋转器一个d

本文介绍了是有可能使用一个expandablelistview作为旋转器一个dropdownview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串的二维数组。我想用一个微调,以允许用户从数组的第二个拉特选择价值观,但我想显示使用数组类的头一号拉特的值在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 a Button plus an AlertDialog containing an ExpandableListView, 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:14