Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent android soft keyboard from resizing my activity

I've an activity that specified as dialog with this line in Manifest like this

android:theme="@android:style/Theme.Dialog"

so how to prevent soft Keyboard from pushing it up and resizing ??

like image 797
BlackRoot Avatar asked Aug 05 '14 15:08

BlackRoot


People also ask

How do you close hide the Android soft keyboard?

You can force Android to hide the virtual keyboard using the InputMethodManager, calling hideSoftInputFromWindow , passing in the token of the window containing your focused view. This will force the keyboard to be hidden in all situations.


1 Answers

You can simply switch your activity's windowSoftInputMode flag to "adjustPan". Check the official documentation for more info.

<activity
   ...
   android:windowSoftInputMode="adjustPan|adjustResize"> 
</activity>

If you are using ScrollView add this too android:isScrollContainer="false" to the ScrollView.

Try it..

like image 70
Lal Avatar answered Sep 28 '22 06:09

Lal