Editor inside Scrollview not scrolling.

I have an editor control inside a StackLayout which is inside a ScrollView. I can scroll all the controls but when I go into an editor control if the text superpasses the editor's height I cannot scroll into the previously added text. So if the line goes out of the visible part of the editor I cannot go back to it, the only way is to erase the whole text and write something up again. So basically trying to scroll inside the editor results in scrolling out the controls inside the scrollview but I just want to scroll inside the editor. By the way editors are added to the stacklayout dynamically.

<ScrollView>
                <StackLayout x:Name="content" Orientation="Vertical"></StackLayout>
            </ScrollView>

Any suggestions?

Thank you.

Answers

  • MarcoMacedoMarcoMacedo BRMember

    DId you found any solution?

  • KaranPatelKaranPatel USMember

    Hi found any solution to this problem

  • KaranPatelKaranPatel USMember

    Hi found any solution to this problem

  • RobinHosRobinHos NLMember

    Thanks @DurgaPrasadMailapalli this worked for me.

  • Oliv3rOliv3r USMember ✭✭

    @DurgaPrasadMailapalli @RobinHos Where do you put the droidListener? And do you have a similar solution to iOS?

  • DurgaPrasadMailapalliDurgaPrasadMailapalli BYUniversity ✭✭

    Hi,
    1. Where do you put the droidListener?
    You can put anywhere in the hierarchy of android solution, and call from custom renderer by this following code nativeEditText.SetOnTouchListener(new DroidTouchListener());

    1. do you have a similar solution to iOS?
      not required for iOS it will scroll individually.
  • dpedrinhadpedrinha DEMember ✭✭✭

    @DurgaPrasadMailapalli that worked great! Thsnk you.

    So sad that Xamarin forms miss such basic behaviors.

  • dheerajkdheerajk INMember

    Hi
    I have a listview and i am using Editor as a cell after entering text 5-6 line text if i am trying to scroll text so list is scrolling instead of scrolling editor text so i tried this solution but its not working for me.

    I have Created class DroidTouchListener

    public class DroidTouchListener : Java.Lang.Object, IOnTouchListener
        {
            public bool OnTouch(View v, MotionEvent e)
            {
                v.Parent?.RequestDisallowInterceptTouchEvent(true);
                if ((e.Action & MotionEventActions.Up) != 0 && (e.ActionMasked & MotionEventActions.Up) != 0)
                {
                    v.Parent?.RequestDisallowInterceptTouchEvent(false);
                }
                return false;
            }
        }
    

    and calling from EditorRenderer Rendere class but its not getting call
    nativeEditText.SetOnTouchListener(new DroidTouchListener());

    OnTouch method is not getting call?

  • tualatintualatin Member ✭✭

    Works like a charm! Thank you.

  • shalinasangashalinasanga USMember

    @dheerajk said:
    Hi
    I have a listview and i am using Editor as a cell after entering text 5-6 line text if i am trying to scroll text so list is scrolling instead of scrolling editor text so i tried this solution but its not working for me.

    I have Created class DroidTouchListener

    public class DroidTouchListener : Java.Lang.Object, IOnTouchListener
        {
            public bool OnTouch(View v, MotionEvent e)
            {
                v.Parent?.RequestDisallowInterceptTouchEvent(true);
                if ((e.Action & MotionEventActions.Up) != 0 && (e.ActionMasked & MotionEventActions.Up) != 0)
                {
                    v.Parent?.RequestDisallowInterceptTouchEvent(false);
                }
                return false;
            }
        }
    

    and calling from EditorRenderer Rendere class but its not getting call
    nativeEditText.SetOnTouchListener(new DroidTouchListener());

    OnTouch method is not getting call?

    Did you Export your renderer ?
    [assembly: ExportRenderer(typeof(Editor), typeof(CustomEditorRenderer))]
    search - register custom renderer xamarin in google

Sign In or Register to comment.