Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to set prefered keyboard view mode from IME

I am developing an android IME and I want my keyboard to work only "pan and scan" and "resize" mode, not in "fullscreen" (as explained here) or at least request to prefer the "resize" mode. I know that there is a way to set this from EditText but how can I request it from the IME? Is there a method that I can call on onStartInputView event? Or how the android system decide which mode will the IME use?

In one of the note applications in landscape mode the default IME don't use the fullscreen mode, but mine is, so there should be something just I can't find it :S. Maybe it checks the height of the keyboard? If yes how? I would appreciate any ideas, thank you!

like image 215
bendaf Avatar asked Aug 01 '15 16:08

bendaf


People also ask

What is IME keyboard android?

An input method editor (IME) is a user control that enables users to enter text. Android provides an extensible input-method framework that allows applications to provide users alternative input methods, such as on-screen keyboards or even speech input.

How do I keep my keyboard visible on Android?

You must have an EditText in your layout and that need to extent EditText base class. then Override onKeyPreIme() method, and return True. Now your keyboard will be always visible and can't be dismissed by Back key. Caution: Because of your onKeyPreIme() method returns true you can't exit your app using back key.

What is soft input mode?

The Android system shows an on-screen keyboard—known as a soft input method—when a text field in your UI receives focus.

What is IME support?

An Input Method Editor (IME) is a software component that enables a user to input text in a language that can't be represented easily on a standard QWERTY keyboard.


1 Answers

I wrote an IME one year ago and also considered that if my keyboard should run in screen mode in landscape on a tablet.

See this. Override the onEvaluateFullscreenMode callback in the InputMethodService class and return whatever you want.

I don't have a try, but this should work.

like image 58
suitianshi Avatar answered Sep 21 '22 04:09

suitianshi