如何在Android Studio上切换软键盘:

huangapple 未分类评论66阅读模式
标题翻译

How to switch between soft keyboards on android studio

问题

我正在处理我为之构建了一些应用程序的设备。其中一个应用程序不需要键盘,但是当光标聚焦在一个输入(用于扫描目的)字段上时,软键盘会弹出,但没有任何作用,所以我决定下载这个“Null Keyboard” 链接

当我退出该应用程序时,整个设备仍然在使用Null键盘。

有人知道我如何在Android Studio的Java中切换回默认键盘吗?

提前感谢!

英文翻译

I am working on devices that I built some apps for. One of the apps requires no keyboard, but when a cursor focuses on an input (for scanning purposes) field, the softkeyboard shows up, but has no purpose so I decided to download this "Null Keyboard" link

When I go out of the app, the entire device is still using the Null keyboard.

Does anyone know how I could switch back to the default keyboard in Java on Android studio?

Thanks in advance!

答案1

得分: 0

你可以通过系统设置返回到默认键盘 -> 语言和输入 -> 键盘 -> 软键盘。或者只需在系统设置中使用搜索。

英文翻译

You can return to default keyboard through System settings -> Language and Input -> Keyboards -> Soft keyboards. Or just using search in system settings.

答案2

得分: 0

如果您可以获取、设置和存储任何给定的东西,您可以在完成时“将其放回”。

对于 Android 和键盘,我怀疑您需要在您的应用获得焦点时获取当前键盘并保存它,然后设置为空键盘。

当应用失去焦点时,您需要将原始键盘设置回来。

您需要在每次获得和失去焦点时都这样做,而不仅仅在应用启动和停止时。

(请注意,我大约有 10 年没有接触 Android 开发了,而且当时经验也不是很丰富。)

英文翻译

If you can get, set, and store something, any given thing, you can "put it back when you're done".

With android and keyboards in particular, I suspect you'd need to get the current keyboard when your app gains focus and save it, then set the null keyboard.

When the app loses focus, you need to set the original keyboard back again.

You'll need to do this every time you gain and lose focus, not just when your app starts and stops.

(Note that I haven't touched android development in something like 10 years, and I was never terribly experienced then either)

huangapple
  • 本文由 发表于 2020年3月4日 05:51:19
  • 转载请务必保留本文链接:https://java.coder-hub.com/60516045.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定