Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent resizing and relayout the window when soft keyboard displaying

I show an edit dialog in an activity, when the soft keyboard displaying, the window of the activity will be resized to too samll which looks awful. I don't want the window of the activity be resized and layout. I just want the keyboard can cover on the activity window and the dialog move to the top so that soft keyboard have room to show.

I have tried to use android:windowSoftInputMode="xxxxx" in the manifest, but there are no one mode which fit my situation. I also found the similar question, but it did't solve my problem.

EDIT: I have tried setImeOptions and also getWindown().setFlags but it still did't worked, Any advice will be very appreciated.

EDIT2: I have tried in 3.0, and use android:windowSoftInputMode="adjustNothing", It worked perfectly, but how can i implement this on 2.3?

like image 677
dreamtale Avatar asked Jul 12 '12 13:07

dreamtale


People also ask

How do I stop the keyboard from popping up on my Android?

Going to settings app and selecting Apps & notifications:And finally clicking on Android Keyboard (AOSP) entry in the app list: Clicking on Disable button and confirming in a pop-up dialog will disable on-screen android keyboard from appearing when trying to type.

What is soft keyboard in Android?

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


1 Answers

add this property in AndroidManifest.xml for your Activity :

android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateUnchanged|adjustPan"
like image 165
throrin19 Avatar answered Jan 02 '23 19:01

throrin19