Androider
Androider

Reputation: 21345

Android OPEN spinner with single button click

I have implemented button which clicks and opens dialog with spinner inside as described here

However this is two clicks. One to open dialog and one to open spinner. I want the spinner to open with a single click of the button? How can this be done?

Is there anyway to just open spinner from button click w/o going to dialog. If not how can I open dialog view and have the spinner open at same time.

Upvotes: 18

Views: 13331

Answers (2)

user2877963
user2877963

Reputation: 57

Define a spinner in your activity with 0 height and 0 width in your xml, then the onItemSelected will work

Upvotes: 2

Flexo
Flexo

Reputation: 2556

Just put this in your button.onClick

spinner.performClick();

Upvotes: 46

Related Questions