Android: Tie a SoftKeyboard (InputMethodService) to an EditText

半城伤御伤魂 提交于 2019-12-03 21:13:58
sjngm

I'm currently reinventing my approach and try to work without the InputMethodService. I keep the sample code as a reference for handling the user input. Basically it should just be a simple view that pops up when needed.

After further research I found a really helpful question about an App-specific soft-keyboard. If you run into my situation, look there.

I can't believe that this isn't possible to do

What I suspect that you wrote was an input method editor, based on your "manually select it" note. This is a global construct, available for the user to elect to install and use if desired. And your input method editor could be used, at the user's discretion, in any application in the device.

You, in your application code, cannot mandate a particular input method editor, whether you wrote it or not.

What you could do, perhaps, is arrange to use the same UI from your input method editor as some sort of pop-up in your activity. For example, KeyboardView, according to Ms. Hackborn, is a standard View and can be used like any other. The user could tap a button next to your EditText to display your keyboard UI (e.g., animated slide up from the bottom of the screen), or something like that.

I also cleaned up the context menu to disallow changing the input method

Please allow the user to choose the input method, or do not use an EditText.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!