Disable scrolling in listview
Solution 1:
Another option without creating a new custom ListView would be to attach an onTouchListener
to your ListView and return true in the onTouch()
callback if the motion event action is ACTION_MOVE
.
listView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return (event.getAction() == MotionEvent.ACTION_MOVE);
}
});
Solution 2:
In your CustomListView:
@Override
public boolean dispatchTouchEvent(MotionEvent ev){
if(ev.getAction()==MotionEvent.ACTION_MOVE)
return true;
return super.dispatchTouchEvent(ev);
}
Then ListView will react to clicks, but will not change scroll position.