0

私のアプリがMarshmallowといくつかのアンドロイドOSでバックグラウンドで動いている間、キーボードは隠されていません。ここに私のコードは私のアプリがMarshmallowでバックグラウンドで動いているときにキーボードが隠れていない

InputMethodManager imm = (InputMethodManager) 
       getSystemService(Context.INPUT_METHOD_SERVICE); 
     imm.hideSoftInputFromInputMethod(getWindow().getCurrentFocus() 
       .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 

答えて

0

私はすでにそれを試してみました。この方法はあまり機能していないこの

if(getCurrentFocus() != null) { 
    InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); 
    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); 
} 
+0

を試してみてください –

関連する問題