Reputation: 51
In my application, I want to scroll ListView
with Java code , I used this code to do that:
holder.items.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listview.smoothScrollToPositionFromTop(0, 0, 500000);
}
}
});
So my question is: How can I prevent user from scrolling ListView
when they touch on screen but user able to touch ListView
content?
Upvotes: 1
Views: 175
Reputation: 97
You can do it by just assigning a listener to your ListView :
listView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if( event.getAction() == MotionEvent.ACTION_MOVE) {
return true; // This Indicates that it has been handled by you
}
return false;
}
});
please retype the solution and don't copy paste (I've just wrote here (no intellicence))
Upvotes: 1