Android OPEN spinner with single button click

2019-03-24 10:59发布

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.

2条回答
唯我独甜
2楼-- · 2019-03-24 11:27

Just put this in your button.onClick

spinner.performClick();
查看更多
一纸荒年 Trace。
3楼-- · 2019-03-24 11:29

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

查看更多
登录 后发表回答