Skip to content

[Android] Window currently doesn't apply AdjustPan so the view doesn't pan up (scroll) when the keyboard opens #11274

@PureWeen

Description

@PureWeen

Description

Original issue here

In XF Window.SetSoftInputMode(Android.Views.SoftInput.AdjustPan); would get called after the OnCreate call whereas in MAUI it's called before OnCreate. It seems like this causes the property to have no effect

If you call this method after OnCreate than everything starts to work like XF.

Reproduction

If you take the XAML below and test a few different permutations, you'll notice that the behavior isn't currently consistent when you open a keyboard

  • Shell: Nothing happens
  • Shell/ScrollView: entry scrolls into view but ScrollView doesn't reset
  • NavigationPage/ScrollView: entry scrolls into view but ScrollView doesn't reset

If you test this scenario on XF all permutations work the same

  • the window pans up (scrolls up) when you open the keyboard
  • you close the keyboard and it pans back down
<StackLayout Padding="10">
            <Entry Text="Top"></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry Text="Middle"></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry></Entry>
            <Entry Text="Bottom"></Entry>
        </StackLayout>

Workaround

Install the nuget here

or

Copy the handler and associated code from here into your code

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions