I have a spinner that acts like a filter for searching among several categories. But the problem is that the spinner allows only one category to select from. Is there a way to obtain a multiple selection behavior for the spinner, or what other alternatives exists?
Code is as follows: Spinner spinner = new Spinner(this); ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.
Spinners provide a quick way to select one value from a set. In the default state, a spinner shows its currently selected value. Touching the spinner displays a dropdown menu with all other available values, from which the user can select a new one. You can add a spinner to your layout with the Spinner object.
Android Spinner is a view similar to the dropdown list which is used to select one option from the list of options. It provides an easy way to select one item from the list of items and it shows a dropdown list of all values when we click on it.
S spinner is designed to show one item at a time. You might get away by making a spinner of checkboxes, but it will be probably an awful user experience.
I would suggest you a ListView instead and CHOICE_MODE_MULTIPLE. You can add a listview to a dialog as shown in this answer: is it possible to create listview inside dialog?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With