How does the Android app suppress the pop-up Input Panel during the entire app run?

Source: Internet
Author: User

You onCreate can completely disable the soft keyboard by adding the following code to your activity's function:

GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,                WindowManager.LayoutParams.FLAG_ALT _FOCUSABLE_IM);

So you can write a base class if you want to take the global effect, for example:

 public  abstract  class  basenoimactivity extends   appcompatactivity {@Override  protected    void   OnCreate (@Nullable Bundle savedinstancestate) { super  .oncreate (savedinstancestate); GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_        FOCUSABLE_IM);    Oncreatestarted (savedinstancestate);  protected  abstract  void   oncreatestarted (@Nullable Bundle savedinstancestate);}  

Then any activity will inherit it, if your project already has a base class, then insert the above code into the base class, the demo example:

 Public class extends basenoimactivity {// inherit base class     @Override    protectedvoid  oncreatestarted (@Nullable Bundle savedinstancestate) {        setcontentview (r.layout.activity_test);        LOG.E ("test", "Testactivity is started");}    }

Referenced from: https://segmentfault.com/q/1010000008489927/a-1020000008490261/revision

How does the Android app suppress the pop-up Input Panel during the entire app run?

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.