Xamarin Forms Android Keybord does not scroll the

2019-07-13 21:19发布

问题:

I'm new to Xamarin forms and I defined few Entry in a tableView for data entry purpose using xamarin.forms. I wrapped them into scroll view so that when keyboard appears, they should scroll.Now, the problem is when keybord appeard it scroll till the Entry which is focused but all below remaining entries/text-boxes remains hidden.I should be able to scroll till end of my list so i can easily edit the fields.Any solution for this (I'm using Xamarin.Forms version 1.4.4)

回答1:

It sounds like your keyboard is covering up entries you want access to. You can change the keyboard to cause the view behind to resize when the keyboard appears. In your droid project, where you define your activity, you should set the WindowSoftInputMode to "adjustResize". Mine looks like this:

[Activity(Label = "View for anyViewModel", Theme="@style/CustomTheme", WindowSoftInputMode=Android.Views.SoftInput.AdjustResize)]


回答2:

That is the default behavior of the ScrollView, it happens on iOS as well.

You can use the LayoutChanged event on the ContentPage to detect when the keyboard pushes everything up, but of course many other things raise that event as well.

You might be better going with a custom renderer for each platform.

An example of an Android one doing similar things with a keyboard is here: How do I keep the keyboard from covering my UI instead of resizing it?