Friday, July 19, 2013

[android help] Custom onInterceptTouchEvent in ListView


Custom onInterceptTouchEvent in ListView


android - Custom onInterceptTouchEvent in ListView - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















How can I implement a custom onInterceptTouchEvent() in a ListView that give the scrolling priority to the child's of the ListView and as soon as they did their scrolling , give it back to the ListView ? I want to give priority to the inner views.


























Try overriding onInterceptTouchEvent() of your children like this:



@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if(!isAtTop || !isAtBottom){
getParent().requestDisallowInterceptTouchEvent(true);
}
return super.onInterceptTouchEvent(ev);
}


In onInterceptTouchEvent() calculate if the ListView has scrolled totally to the top or bottom. If it is somewhere in between then ask the parent to not intercept touches.























default






Read more

stackoverflow.comm



No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...