问题
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