Issue
Xamarin Android.
I have searched and tried many answers from other threads but can not get it to work.
I have been trying to use RequestDisallowInterceptTouchEvent(true); to stop my parent ScrollView from absorbing the Touch Events and allow panning on the MapView thats nested inside it but not successful.
Here is what I have done so far in my Maps Customer Renderer for Android
private IViewParent _scrolLView;
private IViewParent GetParentScrollView(IViewParent parent)
{
if (parent is ScrollViewRenderer)
return parent;
return GetParentScrollView(parent.Parent);
}
public override bool DispatchTouchEvent(MotionEvent e)
{
GetParentScrollView(Parent).RequestDisallowInterceptTouchEvent(true);
return base.DispatchTouchEvent(e);
}
But when I try to pan on the Map, the scroll view still intercepts and scrolls.
Solution
RequestDisallowInterceptTouchEvent is called when a child does not want this parent and its ancestors to intercept touch events .
Try to change GetParentScrollView(Parent)
to this
, it works on my side .
public override bool DispatchTouchEvent(MotionEvent e)
{
this.RequestDisallowInterceptTouchEvent(true);
return base.DispatchTouchEvent(e);
}
Answered By - ColeX - MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.