Reputation: 129
I am trying to use Number picker on activity with parent as Scrollview. Since there are two number pickers arranged vertically. But number picker doesn't scroll properly on Android 4.0.4; though it works well on Android 4.1.2
I even tried to remove one number picker, so that scroll view hides by itself, to see the behavior. But still seeing the same. The numberPicker doesn't change values and get stuck. Though up and down arrows work well, in both the cases.
Without scrollView in place, it works well.
Please help.
Upvotes: 3
Views: 833
Reputation: 965
I know this is an old question, still...
This works for me:
numberPicker.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(final View v, final MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_MOVE && v.getParent() != null) {
v.getParent().requestDisallowInterceptTouchEvent(true);
}
if (event.getAction() == MotionEvent.ACTION_UP) {
v.performClick();
}
v.onTouchEvent(event);
return true;
}
});
Upvotes: 1