Open adrcotfas opened 3 years ago
Any solution or workaround for this?
The obvious workaround approach would be a "dismiss" listener which hides the soft keyboard, but hiding the keyboard is an unsolved problem: https://stackoverflow.com/q/1109022/1682419
Of the 142 answers on SO, the ones I tried didn't work. There's a combination lock on the keyboard, so you have to find the right View and get its window token?
Is this issue still occurring in 1.6.0? I can't reproduce.
It seems this issue has been resolved in https://github.com/material-components/material-components-android/commit/5d6678cc66e64c379818bc294a3db4a19e1005a4, closing.
val view: View? = this.currentFocus
// on below line checking if view is not null.
if (view != null) {
// on below line we are creating a variable
// for input manager and initializing it.
val inputMethodManager =
getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
// on below line hiding our keyboard.
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0)
It doesn't seem resolved in 1.9.0, yes the keyboard gets hidden when the mode is changed (like the commit message says), but when the user dismisses the dialog in any way the keyboard appears again, just like on the video from original message
It doesn't seem resolved in 1.9.0, yes the keyboard gets hidden when the mode is changed (like the commit message says), but when the user dismisses the dialog in any way the keyboard appears again, just like on the video from original message
Same for me. Keyboard re-appears when a MaterialAlertDialog is dismissed
A workaround that worked for me was add stateAlwaysHidden in windowSoftInputMode
<activity
android:name=".features.main.MainActivity"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Description: Using the MaterialTimePicker dialog with _INPUT_MODEKEYBOARD and pressing either positive or negative button will cause the keyboard to re-appear (but alphanumeric, not with digits).
This does not occur when dismissing the dialog by clicking outside of it, only when pressing Cancel or OK while the digits keyboard is open.
https://user-images.githubusercontent.com/11249107/103244036-5fef2f00-4964-11eb-8450-419db5ee3ed1.mp4
Maybe the following is related:
Expected behavior: The keyboard does not re-open after closing the dialog.
Source code:
Android API version: 26 and 30
Material Library version: 1.3.0-alpha03
Device: Emulator Nexus 4 API 30 and Samsung SM-A320FL API level 26