开发者

Can't get keyboard to load onCreate()

开发者 https://www.devze.com 2023-02-05 08:35 出处:网络
My aim is to get the keyboard to open as soon as the app is loaded. Using this code, InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);

My aim is to get the keyboard to open as soon as the app is loaded. Using this code,

InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
                  inputMgr.toggleSoftInput(0, 0);`

on a button, I can get the keyboard to load when the button is pressed. However, when placed in the override onCreate() section, not开发者_运维知识库hing happens.


Add the following line to the activity in AndroidManifest.xml

android:windowSoftInputMode="stateVisible|adjustPan"
0

精彩评论

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