Our code for today will give us an alternative to using the Android spinner. This ListView drop-down functions like a spinner but:
- I love how it looks and response to user touch, it feels smoother and faster than a spinner.
- It can also be easily customized, you won't have to get stuck with default spinner look.
- It can be triggered on any view elements such as a Button, Layout, TextView or EditText.
MainActivity.java - shows the button, set the items for the drop down list, creates the pop up window and then show it as drop down when the button was touched.
DogsDropdownOnItemClickListener.java - triggered when an item on the drop down list was touched, it will change the text on the button and show a toast with the ID of the selected item.
Let me know what you think!
For FREE programming tutorials, click the red button below and subscribe! :)