android - 在 Android Delphi XE8 中隐藏键盘

标签 android delphi keyboard

我真的需要这个!当我进入编辑时,键盘会自动显示..但是当我离开编辑时,键盘不会隐藏!我正在寻找答案,但我做不到! 拜托,有人可以帮助我吗?!

最佳答案

FireMonkey 有管理虚拟键盘的特殊服务。它是 IFMXVirtualKeyboardService ( Embarcadero Docs )。这允许您显示和隐藏键盘。 要隐藏键盘,请尝试以下代码:

uses
  FMX.Platform, FMX.VirtualKeyboard;

procedure TForm5.ButtonHideKeybordClick(Sender: TObject);
var
  KeyboardService: IFMXVirtualKeyboardService;
begin
  if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(KeyboardService)) then
    KeyboardService.HideVirtualKeyboard;
end;

显示键盘

procedure TForm5.ButtonShowKeyboardClick(Sender: TObject);
var
  KeyboardService: IFMXVirtualKeyboardService;
begin
  if TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(KeyboardService)) then
    KeyboardService.ShowVirtualKeyboard(Edit1);
end;

关于android - 在 Android Delphi XE8 中隐藏键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41463963/

相关文章:

android - 仅在发布版本中将 screenOrientation 设置为 "portrait"

java - 使用 View 持有者时,listView 中的行回收如何工作?

android - 更改 remoteView ImageView 背景

Android软键盘永远不会出现在模拟器中

c++ - 如何让我的程序等待键盘输入?

android - 指定 Android 库项目以包含其依赖项的正确方法是什么

android - Android 上的 Delphi FireMonkey TListBox AddObject 异常

delphi - 通过指针修改字符串变量的内容安全吗?

delphi - 如何等待变量?

linux - 如何在没有鼠标的情况下从我的 xterm 复制文本?