在Delphi FMX中自动显示时隐藏Android软键(三角形,圆形,矩形)

问题描述 投票:0回答:1

我在MyApp上将表单设置为全屏。因此,这意味着该表格将覆盖Android屏幕的所有区域,包括软键(在当前的android手机中)和信息栏(电池,simcard,信号信息等)。不幸的是,MyApp使用了fmx(TDialogService.MessageDialog)附带的一些默认对话框沼泽,它将触发设备显示功能键,并且在关闭对话框时不会自动隐藏。

我试图通过添加这样的新过程来隐藏虚拟键盘:

procedure TForm1.HideSoftKeyAndVKeyboard;
var FService: IFMXVirtualKeyboardService;
begin
  TPlatformServices.Current.SupportsPlatformService
      (IFMXVirtualKeyboardService, IInterface(FService));
  FService.HideVirtualKeyboard;
end;

但是该功能键仍然存在。

您对此问题有解决方案吗?非常感谢。

android delphi firemonkey android-softkeyboard
1个回答
0
投票

存在相同的问题,尤其是在匿名线程之后。对我来说,这是>

uses Androidapi.JNI.GraphicsContentViewText, Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, FMX.Helpers.Android, Androidapi.Helpers;

并且在对话结束或线程终止后,此

var
uiOptions: Integer;
begin
uiOptions := SharedActivity.getWindow.getDecorView.getSystemUiVisibility;
SharedActivity.getWindow.getDecorView.setSystemUiVisibility(
            TJView.JavaClass.SYSTEM_UI_FLAG_LAYOUT_STABLE
            or TJView.JavaClass.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            or TJView.JavaClass.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            or TJView.JavaClass.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
            or TJView.JavaClass.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
            or 2048); // SYSTEM_UI_FLAG_IMMERSIVE = 2048
end;
© www.soinside.com 2019 - 2024. All rights reserved.