开发者

How do you hide the keypad on activity change or when edit text is not enabled?

开发者 https://www.devze.com 2023-03-05 04:59 出处:网络
How do you hide the keypad? I\'m currently using the following code to hide the keypad.Is there a better way to do this?

How do you hide the keypad?

I'm currently using the following code to hide the keypad. Is there a better way to do this?

   Window window = getWindow();
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAY开发者_JAVA技巧S_HIDDEN);


You have the right idea for hiding the soft keyboard. You could probably use the SOFT_INPUT_STATE_HIDDEN flag instead of the ALWAYS_HIDDEN one, this would allow it so it will re-open when the user clicks in the EditText without the need to call setSoftInputMode() again.

0

精彩评论

暂无评论...
验证码 换一张
取 消