6

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?

Community
  • 1
  • 1
dreamtale
  • 2,905
  • 1
  • 26
  • 38

2 Answers2

14

add this property in AndroidManifest.xml for your Activity :

android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateUnchanged|adjustPan"
throrin19
  • 17,796
  • 4
  • 32
  • 52
  • Adding android:configChanges statements without knowing exactly what they do is not a good idea. And the "orientation" part is both irrelevant to the question and discouraged. – personne3000 Nov 22 '14 at 12:03
1

I find a method to avoid the problem, but just avoid, still want to know the solution in android 2.3.

Before, I layout the controls in the XML from top and bottom, just like this:

<ToolBar android:id="@+id/blabla"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" />

So when the keyboard is showing, the window of the activity is resized, so the ToolBar is pushed, which looks not good.

Now, I layout the controls from top, through the window is still resized, but the ToolBar and the other controls will not be pushed, they are just layout out of the window, when the soft keyboard is showing.

dreamtale
  • 2,905
  • 1
  • 26
  • 38