android 怎么显示和隐藏键盘输入法?

55次阅读

我的应用里面有一个EditText和Button,我想在当我点击Button的时候让输入法键盘隐藏,请问怎么弄啊?

mila

废话不多说,直接上代码了..

InputMethodManager inputMethodManager =(InputMethodManager)activity.getApplicationContext().
			getSystemService(Context.INPUT_METHOD_SERVICE); 
		
EditText editText = (EditText)findViewById(R.id.xxxx); 
inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(), 0); //隐藏

牛小腩

正文完