代码如下:

@Overridepublic boolean onTouchEvent(MotionEvent event) {InputMethodManager imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);// TODO Auto-generated method stubif (event.getAction() == MotionEvent.ACTION_DOWN) {System.out.println("down");if (MainActivity.this.getCurrentFocus() != null) {if (MainActivity.this.getCurrentFocus().getWindowToken() != null) {imm.hideSoftInputFromWindow(MainActivity.this.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);}}}return super.onTouchEvent(event);}


更多相关文章

  1. android webview显示HTML代码
  2. Android 获取电池基本信息代码
  3. android 打开新浪微博代码
  4. Android 中如何自己通过代码绘图
  5. android 使用代码实现 RelativeLayout布局
  6. android 亮屏及屏幕解锁代码
  7. Android屏蔽home键的代码,咋摁也不响应的方法
  8. Android6.0 Audio系统代码流程
  9. 如何下载Android kernel内核源代码,编译烧写验证

随机推荐

  1. android(3)
  2. Android图形系统之Surface、SurfaceView
  3. android 手机传感器
  4. 在Android平台上加载本地库的危险性
  5. Android 蓝牙难点总结
  6. android网络抓包相关
  7. DataBinding绑定android:onClick出错
  8. Android中短信的广播接收问题
  9. Android中定义接口的用法
  10. android 处理双击事件