Example of status pop-up and disappearance of Android soft keyboard

Recently, I encountered a problem about the soft keyboard. I need to get the status of the soft keyboard, whether it is displayed and recorded for future reference. Common methods of judging status on the Internet

To determine whether the soft keyboard is turned on. If it is equal, it is turned on. After trying, I found that this only works on the keyboard of the mobile phone, and has no effect on the installed third-party input method.

There is also an introduction to using inputmethodmanager to obtain keyboard status. The code is as follows

This can not get the status of the keyboard in real time, and it still has no effect on me.

The solution found later is to monitor the changes of the screen. The code is as follows:

The usage is as follows:

Here are some situations you may encounter:

Bind soft keyboard to EditText

Remove the soft keyboard display:

Never pop up the software keyboard

it's fine too:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>