Modelled on the iOS implementation click on the input box area, soft keyboard hide, a super easy to use library of lightweight.
dependencies {
compile 'com.yinglan.keyboard:hidekeyboard:1.2.0'
}
HideUtil.init(context);
OR
HideUtil.init(context,viewgroup);
OR
//Forced hidden keyboard
HideUtil.hideSoftKeyboard(activity);
OR
//Forced hidden keyboard
HideUtil.hideSoftKeyboard(view);
OR
//Forced hidden keyboard
HideUtil.hideDialogSoftKeyboard(dialog);
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
HideUtil.init(this);
}
}
OR
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewGroup viewGroup = (ViewGroup) findViewById(R.id.activity_main);
HideUtil.init(this,viewGroup);
}
}
OR
view.findViewById(R.id.view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
HideUtil.hideSoftKeyboard(getActivity());
}
});
The library implementation uses the top layer layout android.R.id.content the OnTouchListener listener, rewrite the monitor to be noted.
The work done has been licensed under Apache License 2.0. The license file can be found here. You can find out more about the license at: