Landscape Keyboard Uses Full Screen

Nathan Sokalski 4,116 Reputation points
2021-03-21T21:37:51.43+00:00

I have an EditText that uses a standard numeric keyboard. However, it looks very strange (and ugly) when the device is in landscape. Here are screenshots of portrait & landscape:
79896-screenshot-1616361981.png

79897-screenshot-1616361960.png
Notice that in portrait, the EditText is unchanged from when it is not being edited, but in landscape it fills the entire remaining space of the screen not used by the keyboard. Why does the keyboard (and the EditText itself) look so strange in landscape, and how can I fix it? Thanks.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,296 questions
0 comments No comments
{count} votes

Accepted answer
  1. Nathan Sokalski 4,116 Reputation points
    2021-03-22T17:30:33.737+00:00

    I think you misunderstood my problem. The problem is the fact that in Landscape the entire part of the screen not used by the keys is filled with an area (sort of like a big EditText or something) in which the text is input. I want Landscape to display the keyboard and leave everything else as is, just like it does in Portrait. But I found a solution, which is to include flagNoExtractUi as part of the android:imeOptions property for EditText. This fixed the problem. Hopefully it can help someone else as well.


1 additional answer

Sort by: Most helpful
  1. JessieZhang-MSFT 7,706 Reputation points Microsoft Vendor
    2021-03-22T09:36:52.49+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    It is important to consider how your application will be used and how landscape orientation can be incorporated to improve the user experience. Individual layouts can be designed to accommodate multiple orientations and best use the available space. At the application level, rotation can be disabled or enabled.

    By default, Android XML (AXML) files included in the Resources/layout folder are used for rendering views for an Activity. This folder's resources are used for both portrait and landscape orientation if no additional layout resources are provided specifically for landscape.

    In addition to the layout folder (which defaults to portrait and can also be explicitly named layout-port by including a folder named layout-land), an application can define the views it needs when in landscape without any code changes.

    80055-image.png

    For more details,, you can check document : https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/handling-rotation

    And there is a sample at the botton of above document , you can check it here: https://learn.microsoft.com/en-us/samples/xamarin/monodroid-samples/applicationfundamentals-rotationdemo/

    Best Regards,

    Jessie Zhang

    ---
    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments