You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scrolling of Editor placed in ScollView does not work.
#13632
Assume that the Editor has enough Text to scroll.
If you scroll vertically on the editor after scrolling to the editor, scrolling on the
editor side will not work. Similar to when the Map is placed inside a ScrollView (#13628),
It seems that the tap event is being handled by the Editor's parent control, ScrollView.
Since the build environment has not been prepared, it cannot be confirmed
for iOS, but at least it is as described for Android.
public override bool DispatchTouchEvent(MotionEvent e)
{
if (e.Action == MotionEventActions.Down ||
e.Action == MotionEventActions.Move ||
e.Action == MotionEventActions.Up)
{
// Search EditText Control
var editors = (Window.DecorView as ViewGroup).GetChildrenOfType<EditText>();
foreach (var editor in editors)
{
// Initialize EditText screen position
int[] pos = new int[2];
// Set EditText screen position
editor.GetLocationOnScreen(pos);
// Create hit test rectangle
Rect hitRect = new Rect(pos[0], pos[1], editor.Width, editor.Height);
// Judge hit test
bool isHitTest = hitRect.Contains(e.GetX(), e.GetY());
// Hit test result is OK
if (isHitTest)
{
// Touch event intercept
editor.Parent.RequestDisallowInterceptTouchEvent(true);
}
}
}
return base.DispatchTouchEvent(e);
}
In the MainActivity.cs file, re-implement DispatchTouchEvent, get the EditText that exists
in the page, execute the hit test, and if it is a EditText, intercept the touch event.
Alternatively, you can reimplement the EditText's TouchListener in your EditorHandler
to intercept touch events.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
To reproduce, layout as follows.
Assume that the Editor has enough Text to scroll.
If you scroll vertically on the editor after scrolling to the editor, scrolling on the
editor side will not work. Similar to when the Map is placed inside a ScrollView (#13628),
It seems that the tap event is being handled by the Editor's parent control, ScrollView.
Since the build environment has not been prepared, it cannot be confirmed
for iOS, but at least it is as described for Android.
Android.Emulator.-.pixel_2_-_api_30_5554.2023-03-02.16-11-36.mp4
The only solution I found is below.
In the MainActivity.cs file, re-implement DispatchTouchEvent, get the EditText that exists
in the page, execute the hit test, and if it is a EditText, intercept the touch event.
Alternatively, you can reimplement the EditText's TouchListener in your EditorHandler
to intercept touch events.
Android.Emulator.-.pixel_2_-_api_30_5554.2023-03-02.16-14-55.mp4
Any other good ideas?
I have not confirmed how it works on iOS, so I would like to know if there is no
problem with iOS. Thank you.
All reactions