This article illustrates the basic usage of soft keyboards in Android programming. Share to everyone for your reference, specific as follows:
Call the following code: (The first call shows, then the call is hidden, so repeated), this refers to the activity
Inputmethodmanager IMM = (inputmethodmanager) this.getsystemservice (context.input_method_service);
Imm.togglesoftinput (0, inputmethodmanager.hide_not_always);
Imm.showsoftinput (MyView, inputmethodmanager.show_implicit);
Show hidden soft keyboard individually:
Show:
Inputmethodmanager IMM = (inputmethodmanager) this.getsystemservice (context.input_method_service);
Imm.showsoftinput (myview, 0);
Hide:
Imm.hidesoftinputfromwindow (View.getwindowtoken (), 0);
After the program is started, automatically eject the soft keyboard, you can set a time function to achieve, no longer write in OnCreate:
Timer timer = new timer ();
Timer.schedule (New TimerTask () {
@Override public void Run () {
Inputmethodmanager IMM = (Inputmethodmanager) This.getsystemservice (Input_method_service); Imm.togglesoftinput (0, inputmethodmanager.hide_not_always);
Toast.maketext (Chick.this, "show", Toast.length_short). Show ();
}
, 1000);
For more information on Android-related content readers can view the site: "Android View tips Summary", "Android Layout Layout Skills Summary", "Android Development introduction and Advanced Course", " Android Debugging tips and FAQ Solutions Summary, Android Multimedia tips summary (audio, video, audio, etc.), "Android Basic Components Usage Summary" and "Android Control usage Summary"
I hope this article will help you with the Android program.