0

I have an edittext in my activity, and on activity and on create view I am setting the focus on the activity. while setting focus, I am also trying to show the keyboard. It works on some devices, but on others it just doesn't show.

I tried to step through the code and found that the view is not created, when the show keyboard is called. Maybe that is the reason.

I am not sure what the problem is. Is there a way to make sure, that if a edit text is in focus, the keyboard shows up on app start.

Thanks,

4

2 回答 2

1

您可以尝试通过在 onCreate 期间调用以下行来显示软键盘:

getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);

我希望这会有所帮助。

于 2013-06-14T18:27:40.870 回答
0

在您的AndroidManifest.xml中,将此属性添加到<activity>您希望显示键盘的 Activity 的标记中: android:windowSoftInputMode="stateVisible"

于 2013-06-14T18:55:47.543 回答