1

I created sample project using Android Studio: Create new Project -> Navigation Drawer Activity. In testing purposes, my content Fragmentcontains just a single EditText widget.

In my AndroidManifest I have this line for the main activity:

android:windowSoftInputMode="stateUnchanged|adjustResize"

Odd behavior: if I launch the app in portrait mode, open soft keyboard (by tapping on the EditText) and rotate device to landscape mode... keyboard disappears for some reason. If I create the same project but with no NavigationDrawer (just Activity + Fragment) the keyboard remains visible (as expected with stateUnchanged property).

Did anyone know what is the reason of such behavior? Actually I want to keep the keyboard expanded after switching to landscape mode (if it was opened in portrait). I can track keyboard state and via special flag restore its visibility when needed programmatically, I know. I just wonder why the native tools don't work with NavigationDrawer.

fraggjkee
  • 3,524
  • 2
  • 32
  • 38
  • 1
    My observations: 1. This issue is not seen in Gingerbread. 2. If a spinner drop-down menu is open, the keyboard state is restored correctly on rotation, so maybe a hacky workaround would be to create some invisible window prior to rotation. How did you address this problem? – HaimS Jul 04 '15 at 01:10
  • I'm doing everything manually for now: track rotations, check keyboard's visibility, show/hide the keyboard manually when necessary. – fraggjkee Jul 06 '15 at 12:07
  • Is there any way to determine if the keyboard is visible in full screen (in landscape)? – HaimS Jul 06 '15 at 19:09
  • Yes there is (orientation doesn't actually matter). From my opinion one of the most reliable solutions for that could be found at Telegram for Android - https://github.com/DrKLO/Telegram – fraggjkee Jul 07 '15 at 10:37
  • Are you sure they use the keyboard in full screen when the device is in landscape? I noticed EditorInfo.IME_FLAG_NO_EXTRACT_UI is used in multiple places to avoid the keyboard being set to full screen. Can you please point me to the relevant place in their code? Thanks! – HaimS Jul 14 '15 at 07:02
  • Yes I am sure. Try to install their app and if that's what you need should start from there - https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java – fraggjkee Jul 14 '15 at 10:19

0 Answers0