问题
I want to create a Custom Virtual KeyBoard and use it to replace android's default keyboard. I don't know how I can start it. I am following this SoftKeyboard sample code but I am not getting anything. Please provide me with another source or link that can help me.
Thanks in advance.
回答1:
There're some useful articles and samples in Android SDK. You can find them here.
回答2:
Writing a KeyBoard is not easy... don't expect to see complete tutorials of how to do it, etc. You can learn by seeing how the official keyboard is implemented:
https://github.com/g1011999/Gingerbread-Keyboard/
The link above is a fork of the Gingerbread Keyboard. It's the same source you will find in the android source tree.
回答3:
Here's a very good article by Google itself explaining how a keyboard works. http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
And here's another link (which provides link to the upper one too) which tells you the lifecycle and basic flow of things when you create a custom keyboard. http://developer.android.com/guide/topics/text/creating-input-method.html#InputMethodLifecycle
Also download the samples for the SDK you are using and it has a SoftKeyboard sample in it. Run it on eclipse (It's not easy to run it on Android Studio as of the date of this reply) But it's certainly easy to run on eclipse since it gives you an option to select a sample when you click New Project. Run the sample and install it on your device and go to Settings > Language & Input > Select your Keyboard and uncheck the rest. Boom! You're done! :)
来源:https://stackoverflow.com/questions/5865470/how-to-create-virtual-keyboard-and-use-it-to-replace-the-default-keyboard