简体   繁体   中英

softkeyboard doesn't show in landscape mode?

I have to show app in both orientation but when i tap edittext it shows softkeyboard but it works only in portrait mode.

i used code to show softkeyboard

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
                        InputMethodManager.HIDE_IMPLICIT_ONLY);

and code to hide softkeyboard

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

when i switch on to landscape it doesn't show softkeyboard how can i show softkeyboard in landscape mode.

thanks..

Put this code in manifest and try,

<activity name="your actiivity"
    android:windowSoftInputMode="stateVisible|adjustResize">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM