0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Android】キーボード表示

Posted at

はじめに

キーボードを表示する方法が調べたところ二つ出てきたので、どちらも調べ直さなくいていいようにメモがわりに記事にしておきます。

表示(Java)

binding.edtMessage.requestFocus();
InputMethodManager keyboardManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.showSoftInput(binding.edtMessage, 0);

または、

binding.edtMessage.requestFocus();
InputMethodManager keyboardManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
keyboardManager.toggleSoftInput(1, InputMethodManager.SHOW_IMPLICIT);

表示(Kotlin)

binding.edtMessage.requestFocus()
val keyboardManager = requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
keyboardManager.showSoftInput(binding.edtMessage, 0)

または、

binding.edtMessage.requestFocus()
val keyboardManager = requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
keyboardManager.toggleSoftInput(1, InputMethodManager.SHOW_IMPLICIT)
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?