码迷,mamicode.com
首页 > 移动开发 > 详细

android 软键盘自动弹出和关闭

时间:2015-04-30 19:51:50      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

 一、布局中软键盘自动弹出

 bargain_dialog_offer_edit.requestFocus();

 bargain_dialog_offer_edit.setFocusable(true);

 InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

 imm.showSoftInputFromInputMethod(bargain_dialog_offer_edit.getWindowToken(),0);             

 

二、布局中软键盘自动关闭 

InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);  imm.hideSoftInputFromWindow(talking_edit.getWindowToken() , 0); 

 

三、对话框中软键盘自动弹出和关闭

 

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

android 软键盘自动弹出和关闭

标签:

原文地址:http://www.cnblogs.com/ycxyyzw/p/4469546.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!