MAUI: The UI is shrinking after setting the SoftInputMode to AdjustResize
Sreejith Sreenivasan
1,001
Reputation points
I have a UI and when keyboard appears the header part is not visible like below screenshot.
So I set the SoftInputMode
to AdjustResize
for that page and when leave that page I set it back to AdjustPan.
protected override void OnAppearing()
{
base.OnAppearing();
#if ANDROID
Platform.CurrentActivity?.Window?.SetSoftInputMode(Android.Views.SoftInput.AdjustResize);
#endif
}
protected override void OnDisappearing()
{
base.OnDisappearing();
#if ANDROID
Platform.CurrentActivity?.Window?.SetSoftInputMode(Android.Views.SoftInput.AdjustPan);
#endif
}
The SoftInputMode
was set successfully, but when I came back to the home page, the UI is compressed(Shrink) like below screenshot. (right side actual UI, left side after setting SoftInputMode
to resize image)
If I go to keypad or any other page and come back, the home page UI is showing as normal without shrinking.
In addition I added pan as the SoftInputMode
in MainActivity
.
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
App.Current.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Pan);
}
Developer technologies | .NET | .NET MAUI
4,160 questions
Sign in to answer