I've been trying to create a custom android keyboard. I've started looking over "Creating an Input Method" guide from Google and I was able to create a regular keyboard using the Keyboard and KeyboardView elements.
The problem is that my keyboard needs a scrollview (or a recyclerview) so the user can scroll and see more items of the keyboard - but I don't think this can be achieved using the default Keyboard and KeyboardView elements.
I also tried to override the onCreateInputView method and add a custom layout that contained a scrollview - but the height of the keyboard was taking the entire screen and the user couldn't interact with the app anymore.
So if anyone has some ideas on how I can overcome this issues I would love to hear your suggestions.
Thanks
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 want to know if it is possible to change the layout as in the xml file for the keyboard design for the android keyboard in any case. Also if i want to have two keyboards in alternate to the existing android keyboard how should i make the hide and show functions for the same using the KeyboardView and IKeyboardListener.
On non-rooted device you have to create your own IME.
You can switch between keyboard layouts by KeyboardView.setKeyboard().
BTW, your custom service can inflate any kind of view and you can modify view hierarchy by user actions.
How would I go about creating a dynamic Gif keyboard for Android? I would like the user to scroll horizontally across the Gif's and possibly search across them via an integrated search bar in the keyboard
I've seen this link but it doesn't talk about dynamically changing the keys: How to make a Android custom keyboard?
In your InputMethodService there is a callback onCreateInputView()
You can create whatever custom view you want and return in there.
For horizontal scrolling, maybe look at view pager
I think this issue was posted before. I'm having a custom keyboard and I need to make the app move above it like the softKeyboard with adjust does. Is it possible to do this? Can WindowManager help in any way?
if it's not possible, is it possible to assign a custom soft keyboard to an editbox in the app without prompting the user the dialog for choosing the custom soft keyboard?
Thank you
Can WindowManager help in any way?
WindowManager won't help here, but if you add your entire Keyboard layout to the end of your Activity's layout tree, it should push all other elements up. Using the WindowManager will allow you to "float" the keyboard above the rest of your View.
without prompting the user the dialog for choosing the custom soft keyboard?
This is not allowed for security reasons. You could override onTouch() for that EditText and show your own custom keyboard, but that's about all you can do.