Best alternative for SearchView for Android api level 7 and up?

两盒软妹~` 提交于 2019-12-24 17:17:42

问题


I have created my app for version 4.0+ and now adding support for devices running on Android api level 7+.

I have added ActionBarSherlock for action bar and similar components; so I've solved many problems with that. However, I couldn't find a way for SearchView component. Should I create a custom view which has edit box and call it only devices which don't have SearchView?

How do you solve this problem?


回答1:


since you use actionBarSherlock, you can use SearchViewCompat .

you can also check out this post that i've created.

if you wish to customize the way it looks on multiple android versions, you can use addTextChangedListener on the editText that you will probably use.




回答2:


See this from Android developers site.

PS: Not as per your question, but ABS is deprecated since last Android API. Google rolled out their own implementation of comaptible action bar.




回答3:


For that you can implement TextWatcher in your Activity



来源:https://stackoverflow.com/questions/18206085/best-alternative-for-searchview-for-android-api-level-7-and-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!