前言
变态问题常有,今年特别多,,, - - # 今天遇到的这个非处理不可,不然没法在HTC One S使用SearchView,其软键盘不支持action设置。
声明
欢迎转载,但请保留文章原始出处:)
博客园:http://www.cnblogs.com
农民伯伯: http://www.cnblogs.com/over140/
正文
问题设备:
HTC One S
searchable.xml
<
searchable
xmlns:android
="http://schemas.android.com/apk/res/android"
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 =" ? " />
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。
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>