Android soft keyboard push view

I'm developing a soft keyboard for Android, but I encountered an unsolvable problem. The problem is that when I open the keyboard, it will move other views by mistake (see picture, my keyboard is on the left)

I tried a variety of solutions found in stack overflow or elsewhere, but they didn't work for me

I tried:

android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="stateHidden|adjustPan"
android:windowSoftInputMode="adjustResize|stateVisible|stateAlwaysHidden"

But that doesn't change the behavior you see in the screenshot

So please help me solve this problem

Postscript I know that "adjustresize" or "statehidden | adjustpan" are provided in many similar questions, but it doesn't work for me

P. The screen shot of P.S was taken in Android 6.0.1

thank you.

resolvent:

I finally found the answer problem. You need to use the following code in the class extending inputmethodservice:

@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
     super.onComputeInsets(outInsets);
     if (!isFullscreenMode()) {
        outInsets.contentTopInsets = outInsets.visibleTopInsets;
     }
}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>