仿照iOS实现点击非输入框区域 软键盘隐藏 一款轻量级库
dependencies {
compile 'com.yinglan.keyboard:hidekeyboard:0.0.2'
}
HideUtil.init(this);
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
HideUtil.init(this);
}
}
该实现使用了Activity顶层布局android.R.id.content的OnTouchListener监听,重写此监听需注意;
Apache License Version 2.0