Created
September 1, 2015 10:01
-
-
Save dinabandhuM/724036a49f17d753635e to your computer and use it in GitHub Desktop.
ListView and ScrollView will simultaneously get scroll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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