Android (Android) soft keyboard control (show and hide)

Source: Internet
Author: User

Soft keyboard default when Activity startsStatus

In the manifest file (manifest. xml), you can control the default state of the soft keyboard by adding properties to the Activity tab :

Android:windowsoftinputmode= "Statehidden"

The above Statehidden is a means of hiding, the same statevisible is representative of the visible.

Use the EditView method to control the display of the soft keyboard

EditView provides a way to control whether the soft keyboard is displayed when the focus is on the EditView. (API 21 + )

Here's a look at the documentation:

void Setshowsoftinputonfocus (Boolean show) sets whether the soft input method would be made visible if this TextView gets Focused. The default is true.

We call:

Meditview.setshowsoftinputonfocus (false);

To specify whether the soft keyboard is displayed when the focus is on the EditView, which is displayed by default.

This method applies to custom input methods and does not want the system input method pop-up situation.

Android (Android) soft keyboard control (show and hide)

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.