android – SearchView:键盘不显示按钮完成
作者:互联网
android 4.3.
片段:
<android.support.v7.widget.SearchView
android:id="@+id/searchView"
style="@style/Widget.AppCompat.SearchView.ActionBar"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginStart="20dp"
android:background="@drawable/search_view_bg"
android:imeOptions="actionDone"
android:maxLines="1"
android:inputType="text"
android:theme="@style/SearchViewTheme"
app:defaultQueryHint="@null"
app:layout_constraintLeft_toLeftOf="@+id/searchViewContainer"
app:layout_constraintRight_toRightOf="@+id/searchViewContainer"
app:layout_constraintTop_toTopOf="@+id/searchViewContainer"
app:searchHintIcon="@null" />
我想点击SearchView以显示键盘上的完成按钮.所以我设置了android:imeOptions =“actionDone”.但它没有帮助:
结果如下:
解决方法:
试试这个
searchview.setImeOptions(EditorInfo.IME_ACTION_DONE);
searchview.setSingleLine(true);
标签:android,searchview 来源: https://codeday.me/bug/20190828/1749621.html