开发者

hide keyboard in android?

开发者 https://www.devze.com 2022-12-25 17:04 出处:网络
I am new t开发者_StackOverflowo android development. I am creating an application inwhich when app launches the edittextfield getfocus automatically and the keyboard pop-up.I want to hide the keyboar

I am new t开发者_StackOverflowo android development.

I am creating an application in which when app launches the edittextfield getfocus automatically and the keyboard pop-up.I want to hide the keyboard by default and show when edittextField get focus. I have tried this method but it's not working.

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);


Change your manifest file:

pput it there: (on your especific activity)

android:windowSoftInputMode="stateHidden"


Declaring android:windowSoftInputMode="stateHidden" in corresponding activity tag on Manifest file will solve this. But study about this attribute here.

android:windowSoftInputMode

0

精彩评论

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