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.
Options include:
- 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
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.