Android 键盘不隐藏在背面箭头单击自动完成(Google PlaceSpicker)
Android 键盘不隐藏在背面箭头单击自动完成(Google PlaceSpicker),android,google-places-api,android-softkeyboard,googleplacesautocomplete,google-place-picker,Android,Google Places Api,Android Softkeyboard,Googleplacesautocomplete,Google Place Picker,但是没有起作用。请帮助像这样设置键盘按钮 hideButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { InputMethodManager in = (InputMethodManager) getSystemService
但是没有起作用。请帮助像这样设置键盘按钮
hideButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
in.hideSoftInputFromWindow(getCurrentFocus().getApplicationWindowToken(), 0);
}
});
使用软键盘助手类,如SoftKeyboardHelper.hidethis、searchView;你能详细介绍一下SoftKeyboardHelper吗?在hideKeyboard方法中试试这个:getWindow.setSoftInputMode WindowManager.LayoutParams.SOFT\u INPUT\u STATE\u ALWAYS\u HIDDEN;在哪里放置块代码以隐藏软键盘?onActivityResult?@GianhTran Yeaht这是错误的,当用户单击“上一步”时,不能调用onActivityResultbutton@GianhTran我在简历上也试过了,但没有成功。你有什么建议?
public static void hide(Context context) {
try {
if (context != null) {
InputMethodManager imm = (InputMethodManager) context
.getSystemService(Activity.INPUT_METHOD_SERVICE);
if (((Activity) context).getCurrentFocus() != null) {
View currentFocus = ((Activity) context).getCurrentFocus();
if (currentFocus.getWindowToken() != null) {
imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), InputMethodManager.SHOW_FORCED);
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
hideButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
in.hideSoftInputFromWindow(getCurrentFocus().getApplicationWindowToken(), 0);
}
});