Android display and hide the soft keyboard method (manual) _android

Source: Internet
Author: User

In Android development, there is often a need to hide the keyboard after a certain operation, so that the soft keyboard in Android is not displayed. Today, share with you how to use code to implement the hidden, displayed operation of the Android software disk.

1, method One (if the input method has been shown on the window, then hidden, and vice versa)

Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (Context.input_method_service); 

2, Method Two (view is to accept the soft keyboard input views, show_forced means forced display)

Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (context.input_method_service); 
Imm.showsoftinput (view,inputmethodmanager.show_forced); 

3, invoke the hidden system default Input method

 
 

4, get the input method open state

Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (context.input_method_service); 
Boolean isopen=imm.isactive ();//isopen returns true, means the input method opens

The above is for Android to show and hide the Soft keyboard method (manual), I hope to help.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.