问题
I am building a custom application that uses specific keyboard so when the user run the application, the default keyboard should be changed to my specific keyboard which name is hackers keyboard , How can I do that using java code or by calling adb command from java code , my device is rooted , again this is specific app and the company that I developing for require that.
回答1:
You can use the ime
command to set input method
.
$ adb shell ime
usage: ime list [-a] [-s]
ime enable ID
ime disable ID
ime set ID
回答2:
You could use KeyboardView in your application to open your own Keyboard. Therefore you should overwrite OnTouchListener
of for example the edit textbox.
There is no need to have a rooted device nor to use adb. There is also an example in the Android SDK. It is called "SoftKeyboard".
Or you could have a look for an example on this blog post.
来源:https://stackoverflow.com/questions/15253983/change-the-default-android-keyboard-using-adb-or-java-code