There is a dialog with custom view containing
EditText
as shown below in Typing Hero.You would call
window?.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE)
so user can access the keyboard right away as it shows up.However, calling
window?.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE)
before dialog.show()
can make the view below EditText
not visible.Apparently,
setSoftInputMode
eventually updates the view’s layout which is not yet visible.To prevent that from happening, call
dialog.show()
before window?.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE)
.Maybe it’s worth to mention that this is happening on physical device and NOT not on emulator.