Honeycomb - customize SearchView inside the action bar

Viewed 6768

I have a field where the user can type a search query in the action bar of the application. This is declared in the action bar using a menu inflate in the Activity:

<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
>
    <item
        android:id="@+id/action_search"
        android:showAsAction="ifRoom"
        android:actionViewClass="android.widget.SearchView"
        android:title="@string/search"
    ></item>
</menu>

I need to customize the appearance of the SearchView (for instance background and text color). So far I could not find a way to do it using XML (using styles or themes).

Is my only option to do it in the code when inflating the menu?


Edit #1: I have tried programmatically but I cannot get a simple way to set the text color. Plus when I do searchView.setBackgroundResource(...) The background is set on the global widget, (also when the SearchView is iconified).

Edit #2: Not much information on the Search Developer Reference either

6 Answers
Related