In my app I am using various edit text and text view and list view. Now my problem is my keyboard appears again on orientation change. Ideally when user minimize the keyboard, it should be in minimized state when device is tilted. But it reappears. How do we handle this situation.
My other problem is one of my edit text is some what at the end of screen. When keyboard appears, it hides the edit text. so user is not able to see what he is typing. What is the ideal way to handle this. thanks.
Solution to all problem is this line android:windowSoftInputMode="stateUnchanged|adjustResize"
"stateUnchanged" will make the state of keyboard same as it was in earlier state. Either hidden or visible.
"adjustResize" will make your edit text visible.
Hope this helps.!!!
Edit
This need to be added in android manifest file.
I had this same problem. To keep the keyboard from re-appearing on rotation when you have TextViews, you must do 2 things-
Make sure the TextView doesn't have the focus. Even after hiding the keyboard, a TextView can still be focused. Try calling
textView.clearFocus()
and you should be able to see the difference in the TextView.
Make sure there is another view before it (like a parent LinearLayout, or even just a LinearLayout with 0 width and 0 height) which has these properties-
android:focusable="true"
android:focusableInTouchMode="true"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With