I think that a floating search field is what you want ~ It's not complicated, but its configuration is a little more complicated ~ First you need to configure the search bar option a new profile searchable.xml, like this:
<searchable xmlns:android=http://schemas.android.com/apk/res/android <!-- label is the text at the bottom of the search barοΌhint is the text in the search bar --> android:label="@string/search_label" android:hint="@string/search_hint" android:searchMode="showSearchLabelAsBadge" <!-- voice search --> android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" android:voiceLanguageModel="free_form" android:voicePromptText="@string/search_invoke" <!-- Configure search suggestions--> android:searchSuggestAuthority="com.android.cbin.SearchSuggestionSampleProvider" android:searchSuggestSelection=" ? " />
you should do this in mainfest.xml:
<activity android:name="SearchResultActivity"> <intent-filter> <action android:name="android.intent.action.SEARCH"></action> </intent-filter> <meta-data android:resource="@xml/searchable" android:name="android.app.searchable"></meta-data> </activity> <meta-data android:name="android.app.default_searchable" android:value=".SearchResultActivity" /> <provider android:name="SearchSuggestionSampleProvider" android:authorities="com.android.cbin.SearchSuggestionSampleProvider"></provider>
then override the onSearchRequested Activity function
almost like that, forget the details ~. ~ !!!
Good luck ~
source share