Mr_Hmp
Mr_Hmp

Reputation: 2535

making spinner treat as simple button

i want to click my spinner and take actions just as similar taken by clicking any button , but a dialog is always shown onspinner click, my code is:

 final View.OnTouchListener sp = new View.OnTouchListener() {
        public boolean onTouch1(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                list(); //function to call
            }
            return true;
        }

        @Override
        public boolean onTouch(View arg0, MotionEvent arg1) {
            // TODO Auto-generated method stub
            list();   /function to call

            return true;
        }
    };

Upvotes: 0

Views: 585

Answers (1)

tyczj
tyczj

Reputation: 73721

spinners dont have the ability to do what you want.

what you can do however is create a textview/button with a spinner style so that it looks like a spinner using

style="@android:style/Widget.Holo.Light.Spinner"

then just put an onClick listener to that textview and do whatever you want on the click

Upvotes: 2

Related Questions