(1)在点击事件中关闭键盘
<span style="white-space:pre"> </span>public void onClick(View v) {
<span style="white-space:pre"> </span>// TODO Auto-generated method stub<span style="white-space:pre"> </span><pre name="code" class="java"> <span style="white-space:pre"> </span>InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm.isActive())
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
(2)启动程序时不弹出键盘,需要在AndroidManifest.xml文件中添加如下内容
android:windowSoftInputMode="adjustUnspecified|stateHidden" >