I have an OpenGL SurfaceView in my activity and I’m using keyboard to enter some text (send it over the wire). There is no EditText present, so I am forcing the keyboard to be shown using:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
The activity has defined attribute android:windowSoftInputMode="adjustResize" and this works great in portrait mode, where when keyboard is shown, layout is being resized (and hence the surfaceview as well). It is not happening in landscape mode though, which makes part of the surfaceview (actually, most of it) obscured. The surfaceview implements panning and zooming, so it would be great if I could at least know the size of the keyboard being displayed and reposition the surfaceview accordingly.
Is there a way to make softkeyboard behave in landscape the same way as it does in portrait mode (meaning that it will resize my layout)? If not, is there a way to get the height of the keyboard (apparently in full screen)?
With the help of
android-developersnewsgorup, I was able to solve this problem by using an override on the view (onCreateInputConnection). See original thread.