軟鍵盤遮擋控件時
adjustResize 和 adjustPan 同時使用會有衝突,導致效果都不出現
EditText使用
EditText使用2 延遲顯示輸入法測試有效
軟鍵盤相關
代碼關閉:activity設置是: android:windowSoftInputMode=”stateVisible|adjustResize”
//軟鍵盤管理
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(contentET, InputMethodManager.SHOW_FORCED); // 強制顯示
imm.hideSoftInputFromWindow(contentET.getWindowToken(), 0); // 強制隱藏鍵盤
關閉軟鍵盤(不在合適的時候重新設置 flags 的話,此界面不會再彈出輸入法):int flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
getWindow().addFlags(flags);
//EditText 可否編輯的切換
editText.setFocusableInTouchMode(editEnable ? true : false);
editText.setClickable(editEnable ? true : false);
editText.setCursorVisible(editEnable ? true : false);
editText.clearFocus();