[Android] Window currently doesn't apply AdjustPan so the view doesn't pan up (scroll) when the keyboard opens
See original GitHub issueDescription
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
Issue Analytics
- State:
- Created 10 months ago
- Reactions:13
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Android ScrollView doesn't scroll when the keyboard is up
Where adjustPan does not resize the window, it pans the view so that whatever has focus is never obscured by the soft keyboard....
Read more >Android how to adjust for soft keyboard | by Yat Man, Wong
adjustPan shift the whole page up to make room for the keyboard. adjustResize resize the page, shrink whatever it can to display in...
Read more >Handle input method visibility
When input focus moves in or out of an editable text field, Android shows or hides the input —such as the on-screen keyboard—as...
Read more >Issue with adjustPan and adjustResize how to put ... - YouTube
Android Tutorial - Issue with adjustPan and adjustResize how to put elements above the softkeyboard. 12K views · 3 years ago ...more ...
Read more >Soft keyboard input mode on Android - .NET MAUI
The Pan value uses the AdjustPan adjustment option, which doesn't resize the window when an input control has focus. Instead, the contents of ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

AdjustPan doesn’t solve the problem completely, if the input doesn’t need to be panned to input text it works, but if it pans it still causes the same issue
@PureWeen thanks a lot !!! Really appreciate your hard work.