admin管理员组

文章数量:1384317

My application has been developed using .NET Maui 8.0 primarily for use on Android devices. What I have found is that when running the application on Android in Landscape mode and the focus is on an Entry control, the screen goes blank showing just a simple Done button. It then requires the text to be entered in the top right hand corner of the screen. (The screen is not scrolling up, it just shows nothing).

After the text has been entered and the Done button clicked, the screen is displayed as it should be with the text displayed in the entry box in the correct place.

Is there any way the text can be entered in-place, without hiding the rest of the controls? This happens only in landscape mode, when in portrait mode the entry occurs in-place as it should do.


    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage
        x:Class="WmsClient.View.SettingsPasswordPage"
        xmlns=";
        xmlns:x=";
        Title="SettingsPasswordPage">
        <Grid
            BackgroundColor="White"
            ColumnDefinitions="*"
            RowDefinitions="50,*,80,80">
    
            <VerticalStackLayout Grid.Row="1">
    
                <Label
                    Margin="0,20,0,0"
                    FontSize="26"
                    HorizontalOptions="Center"
                    Text="Password"
                    TextColor="Black" />
    
                <Frame
                    Margin="0,20,0,0"
                    Padding="0,0,0,0"
                    BackgroundColor="White"
                    BorderColor="Gray"
                    CornerRadius="4"
                    WidthRequest="300">
                    <Entry
                        Grid.Row="1"
                        FontSize="20"
                        HorizontalOptions="Fill"
                        IsEnabled="True"
                        IsPassword="False"
                        Text="{Binding EntryText}"
                        TextColor="Black" />
                </Frame>
            </VerticalStackLayout>
    
        </Grid>
    </ContentPage>

This page is displayed when the entry control is tapped

My application has been developed using .NET Maui 8.0 primarily for use on Android devices. What I have found is that when running the application on Android in Landscape mode and the focus is on an Entry control, the screen goes blank showing just a simple Done button. It then requires the text to be entered in the top right hand corner of the screen. (The screen is not scrolling up, it just shows nothing).

After the text has been entered and the Done button clicked, the screen is displayed as it should be with the text displayed in the entry box in the correct place.

Is there any way the text can be entered in-place, without hiding the rest of the controls? This happens only in landscape mode, when in portrait mode the entry occurs in-place as it should do.


    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage
        x:Class="WmsClient.View.SettingsPasswordPage"
        xmlns="http://schemas.microsoft/dotnet/2021/maui"
        xmlns:x="http://schemas.microsoft/winfx/2009/xaml"
        Title="SettingsPasswordPage">
        <Grid
            BackgroundColor="White"
            ColumnDefinitions="*"
            RowDefinitions="50,*,80,80">
    
            <VerticalStackLayout Grid.Row="1">
    
                <Label
                    Margin="0,20,0,0"
                    FontSize="26"
                    HorizontalOptions="Center"
                    Text="Password"
                    TextColor="Black" />
    
                <Frame
                    Margin="0,20,0,0"
                    Padding="0,0,0,0"
                    BackgroundColor="White"
                    BorderColor="Gray"
                    CornerRadius="4"
                    WidthRequest="300">
                    <Entry
                        Grid.Row="1"
                        FontSize="20"
                        HorizontalOptions="Fill"
                        IsEnabled="True"
                        IsPassword="False"
                        Text="{Binding EntryText}"
                        TextColor="Black" />
                </Frame>
            </VerticalStackLayout>
    
        </Grid>
    </ContentPage>

This page is displayed when the entry control is tapped

Share Improve this question edited Mar 21 at 12:48 phm asked Mar 19 at 15:07 phmphm 233 bronze badges 3
  • This might be caused by the XAML structure of the page. Could you edit the post and add the XAML written in the page you mentioned? – tommat208 Commented Mar 19 at 15:12
  • Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented Mar 20 at 7:26
  • I have added the XAML code and also an image of the screen when the entry control is tapped. – phm Commented Mar 21 at 12:50
Add a comment  | 

3 Answers 3

Reset to default 1

Have you seen this article about working with the soft keyboard input mode on Android in .NET MAUI? https://learn.microsoft/en-us/dotnet/maui/android/platform-specifics/soft-keyboard-input-mode?view=net-maui-9.0

I created a new project to test the xaml code you used. And I can only reproduce your problem on the Android 15.0. On the devices that android version is lower than 15 I got:

And then I create a android native project by the Android Studio and test the edittext in Landscape Mode. The same problem appeared.

So this is the default behavior on the android 15. You can post this on the google android help center.

The problem can be resolved by changing the Android IME options for the entry control. This can be done by adding the following lines to the Content Page.

xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
<Entry android:Entry.ImeOptions="NoExtractUi"/>

The XML for the page in full is shown here: -

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft/winfx/2009/xaml"
             xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
             x:Class="WmsClient.View.TestPage"
             Title="TestPage">
    <Grid
            BackgroundColor="White"
            ColumnDefinitions="*"
            RowDefinitions="50,*,80,80">

        <VerticalStackLayout Grid.Row="1">

            <Label Margin="0,20,0,0"
                    FontSize="26"
                    HorizontalOptions="Center"
                    Text="Password"
                    TextColor="Black" />
            <Frame Margin="0,20,0,0"
                   Padding="0,0,0,0"
                   BackgroundColor="White"
                   BorderColor="Gray"
                   CornerRadius="4"
                   WidthRequest="300">
                <Entry
                    Grid.Row="1"
                    android:Entry.ImeOptions="NoExtractUi"
                    FontSize="20"
                    HorizontalOptions="Fill"
                    IsEnabled="True"
                    IsPassword="False"
                    Text="{Binding EntryText}"
                    TextColor="Black" />
            </Frame>
        </VerticalStackLayout>

    </Grid>
</ContentPage>

本文标签: androidEntry on NET Maui 8 Goes to Top Left of Screen in Landscape ModeStack Overflow