tags:

views:

133

answers:

1

How can i change the icon on the right of the search manager? The default icon is an magnifier, but i've seen a app that does display instead of an magnifier an "OK"!

For my needs the magnifier icon is not so good. I use the SearchManager to display the history of typed words. So a better icon is OK instead of a search icon.

A: 

Although documentations said it is deprecated and that the default icon is used, its still worth a shot. Try to do the following.

Corresponding with what you had in your comment regarding meta-data and supplying your own XML resource file for searches.

searchable.xml

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
   android:icon="@drawable/your_OK_image"
   android:label="@string/search_label"
   android:hint="@string/search_hint" >
</searchable>
Anthony Forloney
Thanks but i dont mean the icon on the left.I mean the icon on the button on the right.See this picture --> http://developer.android.com/resources/samples/images/SearchableDictionary2.pngI've tried ic_search_category_default.jpg but with no success.
chrisonline
Try renaming the extension to `.png` I have also revised my answer to offer other alternatives, but I think that's the one we want.
Anthony Forloney
.setIcon is only for the MENU of the app, but not for the search bar at the top i think.I have no .setIcon.To get the search bar i only call onSearchRequested(), afterwards the search bar comes up.In the manifest i added this to my activity: <intent-filter> <action android:name="android.intent.action.SEARCH" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable"
chrisonline
Chris, I updated my answer with another approach, documentations for `SearchManager` give a good understanding that the `icon` attribute is **deprecated** but, we will give it a shot. Try it and let me know.
Anthony Forloney
Thanks, i've tried it but with no success. No icon change.The app i've seen it is ALARMS for Android.This app display instead of the searching icon another icon/button!
chrisonline
No problem, wish we could have figured it out.
Anthony Forloney