问题描述
我目前正在开发一个IME,它会根据输入内容为我生成一个动态密码.我使用了示例SoftKeyboard来进行此项目.
I am currently developing an IME which generate me a dynamic password based on my input.I used the sample SoftKeyboard in order to undertake this project.
当我需要输入密码时,我只需要更改输入法,就目前而言,这似乎还可以.
When I need to type a password, I just need to change the Input Method and for now, it seems to be ok.
我的问题很简单.仅当InputType是类似(InputType = TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)的密码类型时,才有办法允许此IME还是当InputType是密码类型时,是否有一种方法可以指定特定的键盘(在本例中为IME)?
My question is quite simple. Is there a way to allow this IME only when the InputType is a password type like (InputType = TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)Or would there be a method to specify a specific keyboard (in this case my IME) when InputType is a password type?
谢谢!
推荐答案
不是.有两件事控制着IME.首先,用户为电话设置一个默认的IME.没有办法按类型或其他方式将其拆分.其次,该应用可以为文本字段请求特定的IME.通常,只有在应用程序本身提供该IME时,才执行此操作.键盘无法使其成为默认键盘,也无法覆盖类型的默认键盘.
Nope. There's 2 things that control the IME. First, the user sets a single default IME for the phone. There is no way to split this up by type or anything else. Second, the app can request a specific IME for a text field. Usually this is done only if the app itself is providing that IME. There is no way for a keyboard to make itself the default, or for it to override the default for a type.
这篇关于适用于特定InputType的Android自定义IME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!