一:软键盘自动d出。
private EditText top_mIDdle;//输入框//-------------------------------------d出软键盘-----------------------------------top_mIDdle.setFocusable(true);top_mIDdle.setFocusableIntouchMode(true);top_mIDdle.requestFocus();inputMethodManager inputManager =(inputMethodManager) top_mIDdle.getContext().getSystemService( Context.input_METHOD_SERVICE);inputManager.showSoftinput(top_mIDdle,0);Timer timer = new Timer();timer.schedule(new TimerTask(){ public voID run() { inputMethodManager inputManager = (inputMethodManager) top_mIDdle.getContext().getSystemService( Context.input_METHOD_SERVICE); inputManager.showSoftinput(top_mIDdle,0); }},998);
二:软键盘自动关闭。
//-----------------------------------软键盘自动关闭----------------------------------------inputMethodManager imm = (inputMethodManager) this.getSystemService(Context.input_METHOD_SERVICE);imm.hIDeSoftinputFromWindow(top_mIDdle.getwindowToken(),0);
三:对话框中软键盘自动d出和关闭。
//--------------------------------对话框中自动d出和关闭-----------------------------------getwindow().setSoftinputMode(WindowManager.LayoutParams.soFT_input_STATE_VISIBLE | WindowManager.LayoutParams.soFT_input_ADJUST_RESIZE);
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持编程小技巧!
总结以上是内存溢出为你收集整理的Android之软键盘自动d出和关闭【代码分享】全部内容,希望文章能够帮你解决Android之软键盘自动d出和关闭【代码分享】所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)