Rediner Rediner - 2 months ago 15
Android Question

Sliding over buttons?

I was trying for a couple of hours to make this, but I ended up with none.
I would like to make button perform like it was clicked, but with a touch
(act on 0, not on 1). After that, will I be able to 'slide' over these buttons and
make them react in a row?
I am new in this, so please explain me how to make some more advanced actions?

Answer

button.setOnTouchListener would do the trick

button.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN ) {
                //Insert desired code here
                return true;
            }
            return false;
        }
    });

Could you explain what you mean by "slide over these buttons and make them react in a row"?

Comments