Android click the blank space of the screen to stow the input method soft keyboard (open it manually)

Many times, when we use the application, the soft keyboard of input method will pop up. Usually, we will enable the user to click the return key by default or hide the soft keyboard next. For a better experience, we can realize when the user finishes using the soft keyboard. Click the blank area of the screen to realize the function of retracting the input method soft keyboard. Let's introduce the implementation method.

1. / / hide the soft keyboard

In java files:

Or:

In the activity of manifest.xml, write: Android: windowsoftinputmode = "statehidden" to open the activity hidden input method.

2. / / display the soft keyboard. The control ID can be EditText or textview

3. Do not automatically eject the keyboard:

The most ideal implementation method:

The above is what Xiaobian introduced to you. Click the blank space of the screen to put away the input method soft keyboard (open it manually). I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

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