Open torexko opened 6 years ago
Hi @torexko,
it was not intended to use the OnTouchListener at all. What are you trying to achieve? Why do you need to listen for OnTouchEvents?
Best regards, Ingo
Because there is another View interfering with touch events and I can't scroll the TableView. I had the same problem with a ListView inside a ScrollView and I was able to make it work using this piece of code:
listView.setOnTouchListener(new ListView.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
// Disallow ScrollView to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
// Allow ScrollView to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
// Handle ListView touch events.
v.onTouchEvent(event);
return true;
}
});
Hi, I have a problem with the TableView. Setting a new OnTouchListener with .setOnTouchListener() doesn't seem to work properly. The overridden method onTouch never gets called. What am I missing? Is that an intended behavior? How can I register touch events on the TableView? Thank you.