testivanivan
testivanivan

Reputation: 1514

Android. How to implement a custom keyboard?

I'm going to develop a custom keyboard, but I don't understand the sequence of steps that I need to perform in order for everything to work properly. My requirements: the keyboard should automatically show up when you click on a certain type of text input field. That is, I do not plan to use a custom keyboard throughout the entire mobile application, I want to develop a keyboard for entering money and the ability to apply operations to it, that is, the keyboard should only go up for amount entry fields. I tried to find information on how to implement this. Regarding the implementation of the user interface and custom view for keyboard, everything is clear. I'm trying to figure out how to make a custom keyboard work like the system one. And here are the recommendations I found:

  1. Create layout and custom view class.(everything is clear here)
  2. Create implementation of InputMethodService
  3. In the res folder, Create a new directory called xml
  4. Register the custom keyboard in the manifest

But as far as I understand, this method requires the user to select my custom keyboard in the settings for manual use. However, as I wrote above, this option does not suit me; I need my custom keyboard to show up automatically when I click on the amount input field, without any additional actions from the user. Do I understand correctly that a custom InputMethodService is not suitable for me?

Does this mean that for my requirement the only suitable option is to manually track clicks on the input field and focus state and manually show/hide my custom keyboard and at the same time make sure that the system keyboard does not show up?

Please help me, I have been trying for many days to figure this out and decide which approach is the most correct in my case.

Upvotes: 1

Views: 484

Answers (0)

Related Questions