Skip to content

Instantly share code, notes, and snippets.

@dinabandhuM
Created September 1, 2015 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinabandhuM/724036a49f17d753635e to your computer and use it in GitHub Desktop.
Save dinabandhuM/724036a49f17d753635e to your computer and use it in GitHub Desktop.
ListView and ScrollView will simultaneously get scroll
lv.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;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment