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?