Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The User Interface moved up when the keyboard appears in Android platform #20548

Open
VishalOmprasad opened this issue Feb 13, 2024 · 6 comments
Labels
area-keyboard Keyboard, soft keyboard platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@VishalOmprasad
Copy link

Description

I have created a simple .NET MAUI sample, and in the ContentPage I have added a StackLayout with three BoxView(s) and an Entry control as its child. Deployed in Android, when clicking the Entry the keyboard pops up and the UI (Home bar along with the elements) moved upward. This scenario worked fine in iOS platform only the elements in the ContentPage moved upward.

Steps to Reproduce

  1. Create a new .NET MAUI project.
  2. In the MainPage.xaml, add a StackLayout and add 3 BoxView(s) and an Entry control as its child.
  3. Deploy the sample in Android.
  4. Click the Entry control.
  5. Notice that the UI moved up.
MAUI-Android-behavior.mp4

The issue reproducible sample is attached below.
ToolbarDemo.zip

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

No response

@VishalOmprasad VishalOmprasad added the t/bug Something isn't working label Feb 13, 2024
@fntc
Copy link

fntc commented Feb 15, 2024

Recognized that the different (redurced height) screen size is being returned by Page.SizeChanged in my project.
The behaviour changed from android 9 to 10? when it started to return new size values when activating the keyboard. My project had AdjustNothing enabled for the activity.
I saw somewhere in the android documentation google pointed out there are new sources for the screen coordinated to be used.

@tactical-drone
Copy link

tactical-drone commented Mar 19, 2024

This is a regression. This used to work, not anymore. Huge showstopper basically.

We will not be able to hack this because the keyboard is part of the OS, it basically reduced the window size of the app which should be "propagated" downwards like WPF always does. This bug (WPF must be told to resize if kbd pops up or down) might be from the android API as this is one of WPFs core strengths which I have never seen violated before. WPF always reacts to main window size changes immediately! You cannot use the keyboard in Maui anymore at the moment because of this. Nobody seems to be using the platform.

Right now, the keyboard pushes the entire app screen out of bounds at the top. Even if we got a keyboard event we would not know how much to manually reduce our top with to bring the app back into view. This needs to be fixed by Maui team.

Grid.VerticalOptions = Fill is effectively broken. Even flip flopping it between center and fill (in hot+reload) when the bug has occurred does not "fix" the problem. The behavior has changed completely. If your page contains items in keyboard space it will cause the entire application screen to be pushed off at the top by the amount needed else nothing happens. So the only "fix" for now is you got to leave the space at the bottom of the app.

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Mar 20, 2024
@XamlTest
Copy link

Verified this on VS 17.10.0 Preview 2.0(8.0.7). Repro on Android 14.0-API34, not repro on iOS 17.2 with below Project:
ToolbarDemo.zip

@Bloodmagv
Copy link

Greetings,
Might be useful to mention that XAML live preview still believes that the UI components are positioned the same way as they were before keyboard's appearence.
Image

P.S. Any chances this bug will be fixed? After confronting it I really regret that I've chosen MAUI for my project.

@msandikli
Copy link

Is there any progress on this issue? This is a critical bug.

@msandikli
Copy link

msandikli commented Dec 2, 2024

To resolve this issue, you need to add the following command to your MainActivity.cs file. This ensures that when the keyboard is opened, the screen layout is adjusted to make the Entry visible without pushing other UI elements out of place.

protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Window.SetSoftInputMode(Android.Views.SoftInput.AdjustResize);
}

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-keyboard Keyboard, soft keyboard platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants