开发者

Is it possbile to call android spinner from a click of ImageButton?

I have an image button开发者_开发百科 which says Select city I want to call an android spinner if anyone clicks on that image. Is it possible??


I would recommend you check out the App/Alert Dialogs section of the API Demos application. I think what you are looking for is a dialog with a single choice list.

Or take a look at this: http://developer.android.com/guide/topics/ui/dialogs.html#AddingAList


This is entirely possible in several ways. One way is to have a spinner whose visibility is GONE. Clicking on the image makes the spinners visibility VISIBLE. Another choice is to create a dialog that has the spinner and use the selection to do whatever it is you want to do.

There are other options, but that should get you started.


ImageView iv = (ImageView) findViewById(R.id.iv);
        iv.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mySpinner.performClick();
            }
        });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜