I want to create a custom keyboard which will be available in my application only (It’s used jut for a single EditText in one activity), and I was wondering what would be the best way to do so. Here are my specifications for the keyboard:
- It should always be displayed in the activity it is used (Regardless whether the
EditTextis focused or not). - It will have 2 or more keys layouts (Similar to the regular keyboard which has letters layout and a few numbers/symbols layouts).
- Some keys may require some special action (Rather than simply adding their
android:codeskey value to theEditText). - It doesn’t offer candidates for completion/correction.
- It doesn’t offer more than one input type (Like the regular keyboard which has
TYPE_CLASS_NUMBER,TYPE_CLASS_DATETIMEand so on…).
How should I develop it? Should I create a full input method service for it? Or should I create just a KeyboardView and add it to the activity’s layout? (I want to use KeyboardView for the convenience of keys creation and click events handling)
Since it’s a one-off thing and not meant as a separate app, You can simply use whatever method is easiest for you (The
KeyboardViewmethod).Try it out and make sure it’s responsive and snappy. If it works, then simple and easy method would be my recommendation.