以编程方式显示/隐藏虚拟键盘 [英] Programmatically show/hide virtual keyboard

查看:131
本文介绍了以编程方式显示/隐藏虚拟键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使没有使用,我也需要将虚拟键盘保留在屏幕上。
有没有办法强制其可见性?

I need to keep the virtual keyboard on screen, even if not used. Is there a way to force its visibility?

我试图在文本字段上调用 .requestFocus()但键盘引发只有当项目通过鼠标或触摸事件获得焦点时(并且当它失去焦点时消失)

I tried to call .requestFocus() on a textfield but the keyboard raises only if the item gets focus via mouse or touch events (and disappears when it loses the focus)

我想更改此默认行为。

推荐答案

你应该使用这个:

FXVK.init(textfield);
FXVK.attach(textfield);

您传入的节点将是您想要使用键盘写入的输入字段(在这种情况下,它是您的 TextField )。如果你想关闭键盘,只需使用 FXVK.detach();

The Node you will pass in will be the input field where you want to write using the keyboard (in this case, it's your TextField). In case you want to close the keyboard, just use FXVK.detach();

这篇关于以编程方式显示/隐藏虚拟键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆