I want to be able to 'slide' over my buttons and perform like they were each clicked when touched. (Act on 0, not on 1). How can I accomplish this?
Asked
Active
Viewed 88 times
1 Answers
0
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"?

mihanovak1024
- 246
- 2
- 10
-
I mean, I would like to activate another button without releasing finger from the previous click Thanks for reply :) – Rediner Oct 02 '16 at 14:52
-
You mean multitouch? – mihanovak1024 Oct 02 '16 at 14:57
-
No, I mean using one finger to trigger many buttons without releasing it. – Rediner Oct 02 '16 at 15:06
-
So you mean like dragging your finger through buttons and triggering them, something like mobile pattern pascode, where you drag the finger through the circles to unlock your phone? – mihanovak1024 Oct 02 '16 at 15:30
-
Indeed, also it could be a line, which must be slided on continuosly to work. I mean you stop swiping, action stops. – Rediner Oct 02 '16 at 16:14
-
Maybe these links could help you: [link]http://stackoverflow.com/questions/13500318/triggering-multiple-buttonsonclick-event-with-one-swipe-gesture [link]http://stackoverflow.com/questions/21872464/get-button-coordinates-and-detect-if-finger-is-over-them-android – mihanovak1024 Oct 02 '16 at 19:25