开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜