Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android InputMethodService key swipe language changing

I have made an Android custom keyboard app with InputMethodService.
Now I want to make swipe on space key, so when user swipes space key, language of keyboard changes to next (swipe to right) or previous (swipe to left).

public class CustomKeyboard extends Keyboard{...}  

public class CustomKeyboardView extends KeyboardView{...}

public class CustomKeyboardIME extends InputMethodService implements KeyboardView.OnKeyboardActionListener{...}

Can someone please help me with this problem?

Thank you.

like image 941
filipst Avatar asked Mar 26 '26 13:03

filipst


1 Answers

You can't with keyboard view. Or rather, it would be extremely difficult. You'd pretty much need to subclass KeyboardView and overwrite the touch handler, implementing gesture detection and hit detection yourself. That's why no real keyboard actually uses KeyboardView (not even Google's default keyboard), they all make custom views. KeyboardView is really only suitable for quick tests of simple things like new key layouts or new prediction engines.

like image 165
Gabe Sechan Avatar answered Mar 31 '26 09:03

Gabe Sechan



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!