customauto EditText フィールドを作成しました。テキスト フィールドに関する私の問題は、EditText をクリックするとキーボードが上昇するが、他の場所をクリックするとキーボードが開いたままになることです。この問題で私を助けてください
カスタム自動 EditText の名前は auto_list です。onFocusChangeListener を添付しました
auto_list.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if (hasFocus) {
getActivity()
.getWindow()
.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
else{
InputMethodManager im = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
});