I have a vertical sliding drawer at the bottom of my app. When the soft keyboard opens, it pushes the tab for the drawer up, so it sits atop the keyboard. I actually want it
When you want to hide view when open keyboard.
Add this into your Activity in manifest file
android:windowSoftInputMode="stateHidden|adjustPan"
For xamarin users add this code to Activity attribute of the MainActivity class,
WindowSoftInputMode =Android.Views.SoftInput.AdjustNothing
or you can add this code Window.SetSoftInputMode(Android.Views.SoftInput.AdjustNothing)
to the OnCreate method of MainActivity class.
This code may help you. Use it in your oncreate
method.
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
For Scroll View:
if after adding android:windowSoftInputMode="stateHidden|adjustPan"
in your Android Manifest and still does not work.
It may be affected because when the keyboard appears, it will be into a scroll view and if your button/any objects is not in your scroll view then the objects will follow the keyboard and move its position.
Check out your xml where your button is and make sure it is under your scroll View bracket and not out of it.
Hope this helps out. :D
You can simply switch your Activity's windowSoftInputMode
flag to adjustPan
in your AndroidMainfest.xml
file inside your activity tag.
Check the official documentation for more info.
<activity
...
android:windowSoftInputMode="adjustPan">
</activity>
If your container is not changing size, then you likely have the height set to "match parent". If possible, set the parent to "Wrap Content", or a constraint layout with constraingts to top and bottom of parent.
The parent container will shrink to fit the available space, so it is likely that your content should be inside of a scolling view to prevent (depending on the phone manufacturer and the layout choosen...)
even if the layout it is in is a relative or constraint layout, the content could exhibit problems 1-3.
To do this programatically in a fragment you can use following code
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Place this in onResume()