Delphi 使用IFMXVirtualKeyboardService隐藏虚拟键盘后,虚拟键盘将丢失

Delphi 使用IFMXVirtualKeyboardService隐藏虚拟键盘后,虚拟键盘将丢失,delphi,firemonkey,delphi-xe7,Delphi,Firemonkey,Delphi Xe7,我的表格上有一个TEdit和一个TTMSFMXWebGMaps。在我编辑的OnKeyUp()事件中,我有以下代码来隐藏iPhone4的虚拟键盘: if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService) then (TPlatformServices.Current.GetPlatformService(IFMXVirtualKeyboardService) as IFMXVirt

我的表格上有一个
TEdit
和一个
TTMSFMXWebGMaps
。在我编辑的
OnKeyUp()
事件中,我有以下代码来隐藏iPhone4的虚拟键盘:

if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService) then
      (TPlatformServices.Current.GetPlatformService(IFMXVirtualKeyboardService) as IFMXVirtualKeyboardService).HideVirtualKeyboard;
问题是,如果不将焦点切换到另一个控件,我无法再次显示键盘。我在编辑的
OnTap()
中尝试了此操作,但无法恢复键盘:

  if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService) then
    (TPlatformServices.Current.GetPlatformService(IFMXVirtualKeyboardService) as IFMXVirtualKeyboardService).ShowVirtualKeyboard(edSearch);

由于我的表单只包含一个
TEdit
,除非用户导航到另一个表单并返回,否则键盘将永远丢失。有什么想法吗?

有一种非常简单的方法可以隐藏虚拟键盘

uses
{$IFDEF IOS}
  FMX.Forms
{$ENDIF}
{$IFDEF Android}
  Androidapi.JNI.Embarcadero,
  FMX.Platform.Android,
  FMX.Helpers.Android
{$ENDIF};

procedure HideVirtualKeyboard;
{$IFDEF IOS}
begin
  try
    Screen.ActiveForm.Focused := nil;
  except
  end;
end;
{$ENDIF}
{$IFDEF Android}    
var
  TextView: JFMXTextEditorProxy;
begin
  try
    begin
      TextView := MainActivity.getTextEditorProxy;
      CallInUIThread(
        procedure
        begin
          TextView.setFocusable(false);
          TextView.setFocusableInTouchMode(false);
          TextView.showSoftInput(false);
          TextView.clearFocus;
          TextView.setFocusable(true);
          TextView.setFocusableInTouchMode(true);
        end);
    end
  except
  end;
end;
{$ENDIF}

你不能做一个切换按钮来启用和禁用virtualkeyboard。@不,从用户的角度考虑一下,我真的不明白你想做什么。你想只在第一次之后显示键盘吗?@Remi我想能够随意显示/隐藏键盘。目前,我可以隐藏键盘,但我不能再次显示它OK,但你到底什么时候不想显示和隐藏它?你能给我一个更详细的解释吗?我的delphi没有像我使用Androidapi.JNI.Embarcadero那样识别JFMxteditorProxy,知道吗?