使用 SetImeOptions NoExtractUi 或 NoFullscreen 在 Xamarin Forms Android 中禁用全屏模式不起作用,如何解决这个问题?

问题描述

我正在开发使用 AutoSuggestBox 的 Xamarin 表单应用。

在横向模式下的 iOS 上,它可以正常工作,但是在横向模式下使用 Android 时,由于全屏模式,它隐藏了键盘下的所有建议选项。

我在 AutosuggestBoxhave tried using android:Entry.ImeOptions="NoExtractUi" 但它对我不起作用,因为底层 Entry 没有暴露,所以我试图孤立地实现这个机制。

然后我在视图上添加一个测试 Entry 控件,看看它是否可以工作。但是,这也行不通。

我的 xaml:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="StruebyPhotoApp.MobileApp.Views.NewItemPage"
         xmlns:asb="clr-namespace:dotMorten.Xamarin.Forms;assembly=dotMorten.Xamarin.Forms.AutoSuggestBox"
         xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
         ios:Page.UseSafeArea="true">

    <ContentPage.Content>
    <StackLayout Spacing="3" Padding="15">
        <Entry android:Entry.ImeOptions="NoExtractUi" x:Name="TestText" />

为了加倍,我还在构造函数添加

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
 
public NewItemPage()
{
        InitializeComponent();
        TestText.On<Android>().SetImeOptions(ImeFlags.NoExtractUi);
}

我也尝试将 NoExtractUi 更改为 NoFullscreen 并使用
TestText.On<Android>().SetImeOptions(ImeFlags.NoExtractUi|ImeFlags.NoFullscreen);

我仍然在 Android 10

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)