I wish to add custom buttons to the android IME. So I have created an InputMethodService extension as done with soft keyboard sample from code samples. But in SoftKeyboard sample a candidate view is been used to add predictive text. So I was try to use the same approach but how can I listen to onclick events when I add button on the candidate view. Is this the best way to add buttons above keyboard?
How can I change the background of each letter in the keyboard already provided or even change the buttons?
Thanks,
nil
Related
Keyboard handling is still a major setback in Android app development. Let me be specific about my question, I want to provide animation for soft keyboard appearance. I know it is not feasible directly but do anyone know any workaround / tweaks & tricks for this?
you can try creating a custom soft keyboard and register your edittext to load this keyboard (take a look at the plethora of custom keyboards you can use https://android-arsenal.com/tag/232)
An example is "Floating KeyboardView" https://android-arsenal.com/details/1/5247 shows you how you can customise your keyboard.
Use it as normal keyboard view and
Place FloatingKeyboardView inside a FrameLayout or a RelativeLayout
(TIP: Put it last or/and with some elevation)
Make an xml with your keyboard layout
(https://developer.android.com/reference/android/inputmethodservice/Keyboard.html)
Declare it in activity code
FloatingKeyboardView mCustomKeyboard = (FloatingKeyboardView) findViewById(R.id.keyboardview);
Assign the keyboard layout
mCustomKeyboard.setKeyboard(new Keyboard(this, R.xml.numkbd));
Register edittexts to use it
mCustomKeyboard.registerEditText(R.id.edittext1);
I have two EditText in my layout, and another layout that contains a custom designed keyboard using ImageButtons. Using these two layouts, I want to:
When the EditText is clicked/touched, hide the default keyboard.
Display the custom keyboard (like a replacement to the default keyboard).
Hide the keyboard after clicking back/return key.
I was able to hide the default keyboard by setting the InputType of the two EditText to NULL. However, it means that the cursor will no longer be visible when EditText is focused. This is part of the specifications of the project.
How do I best approach this problem? What could be a best solution?
Edit: Project specifications were changed. However, I would still love to have the solution or approach to this problem / issue. Thank you very much.
I read most of the tutorials to make a SoftKeyboard for Android and all of them talking about using android.inputmethodservice.KeyboardView and xml file with Keyboard element to make the keyboard.
The Keyboard element only accepts row as child and row only accepts key so I can't add another UI components like EditText or any other UI components.
At first I though that can't be done but during my search I found this keyboard which has search and search results in the keyboard.
So how can I make a custom keyboard layout like this?
I want to show softkeyboard after tapping on EditText in my custom Softkeyboard.
I have made one custom keyboard in which I've added one key.
This key will navigate you to a Conversion View which contains an EditText.
So after tapping on that EditText I want to open my own custom softkeyboard.
Please reply me as soon as possible.
You have two options: create a soft keyboard using the InputMethodService--that is, create a true soft keyboard that will be listed under the keyboard listing in the device's settings that the user can turn on and use at any time. That can be a lot of work.
You're other option is to mock the soft keyboard by creating a custom view, of which you handle input and toggle the visibility of explicitly in your app; blocking the native soft keyboard from showing (which you can do per activity via your manifest or in code).
I would like to remove the navigation buttons at the bottom of the soft keyboard ( the buttons with the arrow- they act like a tab key to move between fields). I have had no luck trying to find a way to do this. Does anyone have any suggestions
What you're describing is device-specific, as each device has its own default soft keyboard. Unfortunately, you'll need to make a custom keyboard.
Look at the Keyboard class.
I don't believe it's possible to remove the button from the keyboard, but you can at least specify which neighbor the field gives focus to. See Handling UI Events on the Android Dev Guide.
Perhaps it's possible to set nextFocusDown to nothing, so the keyboard doesn't let the user navigate in that fashion. If that doesn't work, you might consider setting the field that takes focus next to setFocusable(false).