TharakaNirmana TharakaNirmana - 5 months ago 15
Android Question

Stop scrolling in a listview when user touches the list - android

I have a list view that contains about 30 items. When I scroll it down it just goes to the very bottom of the list and does not stop when the user touches the list.

Is there a method to stop the scrolling when the list view is touched and at the same time user should be able to navigate using onItemClick(already handled)..

Thank you!

Answer

Try this smooth scrolling

 @Override 
 public boolean onTouchEvent(MotionEvent ev) 
 { 
 switch (ev.getAction()) 
    {
    case MotionEvent.ACTION_UP: this.smoothScrollBy(0, 0); 
    break; 
    } 
    return super.onTouchEvent(ev); }
Comments