LoginSignup
18
19

More than 5 years have passed since last update.

Activity起動の時点でソフトウェアキーボードを表示する

Posted at

ソフトウェアキーボードの常時表示

EditTextなどを使うアプリを作るときに、
編集する部分をタップしてからキーボード(IME)を出すのではなく、
最初からキーボードを出しておきたい時があります。

初めはEditTextの属性やらInputMethodManagerの設定やらを変えて
起動時に表示できるよう格闘していたのですがなかなかうまく行きませんでした。

いろいろ調べてみた結果、

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

で起動時のソフトウェアキーボード表示が出来ました。
Windowに対してキーボードを出すよう指定してあげないと行けないみたいです。

参考

http://stackoverflow.com/questions/2403632/android-show-soft-keyboard-automatically-when-focus-is-on-an-edittext
英語でググってみるのは大事ですね‥

18
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
19