I'm creating an Android app and I want to put a lot of short items to Spinner. Basically, it works:
But it doesn't work as I want. As you can see, there is a lot of items which have a very short text. It means that user may be forced to scroll a lot to find an item (s)he want. What I want to do is to put items in multiple columns, but I don't know how to do it. I searched in the internet for a while and the only solutions I've found were "how to put multiple columns in 1 item" - what I want is "how to put items in multiple columns".
Thanks.
First you should create your custom spinner adapter. Then, you can put 3 textviews in a row in your list.
On the getView function of your adapter: 1)Instantiate your custom layout (which has 3 textviews) 2)Give each textview a tag like this:
Thus you can assign the same onClickListener to them. (You should do this in getView function too) Finally, on the onClick listener, get the clicked item's tag, convert it to integer (which is your items position on the list), get the item on the list with this position, and set your spinner's text with it.