Из фрагмента я использую SearchView внутри AlertDialog, и я хотел бы, чтобы кнопка «Готово» на клавиатуре отклоняла клавиатуру. По какой-то причине это не работает.
Вот мой AlertDialog "
val mBuilder =
AlertDialog.Builder(context!!, Theme_DeviceDefault_Light_NoActionBar_Fullscreen)
val mView = View.inflate(activity!!, R.layout.list_search, null)
mBuilder.setView(mView)
val dialog = mBuilder.create()
val searchView = view.findViewById<SearchView>(R.id.search_view)
dialog.show()
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE)
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
adapterWithSearch.filter(newText)
return true
}
override fun onQueryTextSubmit(query: String): Boolean {
adapterWithSearch.filter(query)
return true
}
})
А вот мой SearchView:
<SearchView
android:id="@+id/searchView"
style="@style/AppTheme.Searches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:actionViewClass="android.support.v7.widget.SearchView"
android:iconifiedByDefault="false"
android:imeOptions="actionDone"
android:inputType="text"
android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true" />
Я бы хотел, чтобы клавиатура была отклонена, а не AlertDialog. идея, почему клавиатура не сбрасывается со счетов?