1

I want to apply Orange style to my search view which is an item in the action bar menu , I generated the orange style using http://android-holo-colors.com/ and I assigned the style to my search view using

 <item
        android:id="@+id/menu_search"
        style="@style/EditTextOrange"
        android:actionViewClass="android.widget.SearchView"
        android:icon="@drawable/action_search"
        android:showAsAction="always"
        android:title="search"/>

my style

<?xml version="1.0" encoding="utf-8"?>

<!-- Generated with http://android-holo-colors.com -->
<resources xmlns:android="http://schemas.android.com/apk/res/android">

  <style name="EditTextOrange" parent="android:Widget.EditText">
      <item name="android:background">@drawable/edit_text_holo_light</item>
      <item name="android:textColor">#000000</item>
  </style>

</resources>

How can I apply the style to my search view ?

2 Answers2

1

You can change the SearchView drawable like this:

<style name="EditTextOrange" parent="android:Theme.Holo">

    <item name="android:searchViewTextField">@drawable/mySearchView</item>

</style>
Ahmad
  • 69,608
  • 17
  • 111
  • 137
1

I solve the problem using textfield_activated_holo_light image which is generated from http://android-holo-colors.com/

searchPlate.setBackgroundResource(R.drawable.textfield_activated_holo_light);
  • Hey @Mohammed, the only issue is that the Holo drawable which just looks like an underline seems to be positioned further away from the bottom of the `ActionBar` then the default Holo underline? Why is that? – Etienne Lawlor Jun 24 '13 at 07:54