maui
maui copied to clipboard
The UI is shrinking after setting the SoftInputMode to AdjustResize
Description
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 successfully set and reset when entering and existing that particular page. 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 any other page and come back, the home page UI is showing as normal without shrinking.
I have 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);
}
Steps to Reproduce
I created a demo with this issue and uploaded here. Could you please check with this.
Click on option 1 and click the editor and open the keyboard, then go back to home, then you can see this issue. If we press option 2 this shirking issue is getting resolved.
Link to public reproduction project repository
No response
Version with bug
7.0.100
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android
Did you find any workaround?
I already posted this question on here and here, but I didn't get a better solution.
My actual home page is a CarouselView with 5 child ContentViews. As per the suggestion from the above questions I added VerticalStackLayout for CarouselView. But in that approach I am facing some issues. One is there is a lot of blank space at the bottom of the home page. Other issue is, the UI of other home page child tabs are breaking. So I need a perfect solution that will not affect any other pages?
Relevant log output
No logs
Hi @sreejith-pagematics. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
I verified it on visual studio Version 17.9.0 Preview 2.1 with .Net 8. But still facing the same issue.
I have created a demo project and uploaded here. Could you please check.
Verified this on Visual Studio Enterprise 17.10.0 Preview 1(8.0.6). Repro on Android 14.0-API34 with below Project: ShrinkDemo.zip