Android Hidden Input Method

Source: Internet
Author: User

You can set Setinputtype (inputtype.type_null) for EditText, and the input method will not pop up. When needed, set the Inputtyep dynamically.

If a load activity can be used GetWindow (). Setsoftinputmode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

Hide the Input method, you do not have to judge the focus. O (∩_∩) o

If you want to get to the focus of the hidden input method, you can try (I did not try, but in the project code to see. On the record)

Hide Phone keyboard

private void Hideim (View EDT) {

try {

Inputmethodmanager im = (inputmethodmanager) getsystemservice (Activity.input_method_service);

IBinder Windowtoken = Edt.getwindowtoken ();

if (Windowtoken! = null) {

Im.hidesoftinputfromwindow (Windowtoken, 0);

}

} catch (Exception e) {

}

}

When setting Onfocuschangelistener, you can call this

Kaishiriqi.setonfocuschangelistener (New View.onfocuschangelistener () {

public void Onfocuschange (View V, Boolean hasfocus) {

if (Hasfocus = = True) {

Timeflag = 0;

Hideim (v);

ShowDialog (0);

}

}

});

There are a lot of ways to do this first. Welcome to add ....

Android Hidden Input Method

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.