i'm developing a soft keyboard for an android and I faced a problem which I could not solve. The problem is that when I open a keyboard it moves other views incorrectly (see the picture, my keyboard on the left).

I have tried multiple solutions that I found on stackoverflow or somewhere else, but they didn't work for me.
I've tried:
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="stateHidden|adjustPan"
android:windowSoftInputMode="adjustResize|stateVisible|stateAlwaysHidden"
but it didn't change the behavior you see on the screenshot.
So, please help me to solve this problem.
Ps. I know that there are many similar questions where "adjustResize" or "stateHidden|adjustPan" is offered, but it doesn't work for me.
P.p.s screenshot is taken in android 6.0.1.
Thanks.
I finally found an answer to my question. You need to use this code in your class that extends InputMethodService:
@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
if (!isFullscreenMode()) {
outInsets.contentTopInsets = outInsets.visibleTopInsets;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With