Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android floating keyboard

Is it possible to change programmatically the position of the keyboard? I'm developing an app for a totem, and if the keyboard appears docked on the bottom, it's very difficult to use.

I tried to create a custom keyboard extending the InputMethodService, and i'm able to change the layout of the keys, but i'm not able to change the keyboard's view position.

SwiftKey allows to undock the keyboard and to drag it vertically, how can they do that?

like image 373
cark Avatar asked Apr 23 '26 19:04

cark


1 Answers

Inside InputMethodService, you have reference to a Window. Add your dragging logic to update LayoutParams for the window. Make sure you implement onComputeInset properly. On a note that the gravity of window is always CENTER horizontally and BOTTOM vertically even though you try to use a new LayoutParams for the window.

Check out my sample https://github.com/dbof10/float-keyboard enter image description here

like image 118
Ken Zira Avatar answered Apr 26 '26 08:04

Ken Zira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!