I've investigated standard controls and found a one that does work alike (multiline EditText) and a one working as expected (SeekBar). I would like to check also ScrollView inside a ScrollView, but fortunately I did find a solution for this issue only by using SeekBar sources from Android SDK (I have old ones, but it was enough).
The main problem was with WheelView.onTouchEvent() - it did not receive all touch events because they were processed by parent (scroll view). So it needed to ask the ScrollView to skip touch events and allow the wheel to perform them by onTouchEvent(). There is a corresponding method for a parent view called ViewParent.requestDisallowInterceptTouchEvent(). SeekBar calls it during handling the ACTION_MOVE touch event action. I've added this approach to the wheel view and it works too! :)
@Override public boolean onTouchEvent(MotionEvent event) { if (getViewAdapter() == null) { return true; } if (!gestureDetector.onTouchEvent(event) && event.getAction() == MotionEvent.ACTION_UP) { justify(); } // Fix scrolling if (event.getAction() == MotionEvent.ACTION_MOVE && getParent() != null) { getParent().requestDisallowInterceptTouchEvent(true); } return true; }
I'm unable to commit this fix now because of working on custom views for wheel items; will do that later. So please fix your code manually. Thanks!
Thanks for the update Kankan! Looking forward to custom views work also!
ReplyDeleteThanks it was helpfull
ReplyDeletejust found out about this widget - think it is amazing - great job!
ReplyDeleteThanks for the post. Just to let you know that this didn't work until I added the following:
ReplyDelete@Override
public boolean onInterceptTouchEvent(MotionEvent p_event)
{
return true;
}