前言
变态问题常有,今年特别多,,, - - # 今天遇到的这个非处理不可,不然没法在HTC One S使用SearchView,其软键盘不支持action设置。
正文
问题设备: HTC One S
searchable.xml
android:label="@string/search_label"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:imeOptions="actionSearch"
android:searchSuggestAuthority="com.xxx.provider.searchsuggestion"
android:searchSuggestSelection=" ? " />
解决办法:
SearchView有一个setSubmitButtonEnabled方法,设置为true即可,搜索框不为空就会显示。效果如下图:
在onCreateOptionsMenu中inflate后调用,记得判断API Level。
以上就是 对设备 HTC One S解决SearchView时软键盘不支持actionSearch,希望能帮助开发Android软件的朋友。