Consider a MaterialAutoCompleteTextView nested in a TextInputLayout using an ExposedDowpdownMenu. How do I hide a Softkeyboard already shown by a previous TextInputEditText? It also should hide the keyboard if we navigate from the previous focused TextInputEditText with an imeOption=actionNext. Since the MaterialAutoCompleteTextView decorated with an ExposedDropdownMenu is not focusable onFocusChanged() does not work. Additionally, I didn't found any property like i.e. "onShowDropDown" or similar to trigger my "hideKeyboard()" method.
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".75"
android:layout_marginStart="8dp"
android:hint="@string/cvinfo_city"
android:layout_marginBottom="@dimen/default_margin">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/cvinfo_city"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
android:text="@={viewModel.user.general.address.city}" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/cvinfo_country"
android:layout_marginBottom="@dimen/default_margin">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/cvinfo_country"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionDone"
android:maxLines="1"
android:text="@{viewModel.user.general.address.country}" />
</com.google.android.material.textfield.TextInputLayout>
imeAction=next keyboard does not hide
Also want to hide keyboard if dropdown shows
question from:
https://stackoverflow.com/questions/65899406/android-materialautocompletetextview-hide-keyboard-on-show-exposeddropdownmenu 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…