How to avoid soft keyboard pushing up my layout? [duplicate]
I did have the same problem and at first I added:
<activity
android:name="com.companyname.applicationname"
android:windowSoftInputMode="adjustPan">
to my manifest file. But this alone did not solve the issue. Then as mentioned by Artem Russakovskii, I added:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:isScrollContainer="false">
</ScrollView>
in the scrollview.
This is what worked for me.
In my case, the reason the buttons got pushed up was because the view above them was a ScrollView
, and it got collapsed with the buttons pushed up above the keyboard no matter what value of android:windowSoftInputMode
I was setting.
I was able to avoid my bottom row of buttons getting pushed up by the soft keyboard by setting
android:isScrollContainer="false"
on the ScrollView
that sits above the buttons.
To solve this simply add android:windowSoftInputMode="stateVisible|adjustPan
to that activity in android manifest file. for example
<activity
android:name="com.comapny.applicationname.activityname"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible|adjustPan"/>