Search code examples
androidsearchview

change x mark icon in searchview


I have a searchview below action bar .I tried replacing the x mark(close icon) with another drawable .I tried the code below and i am getting this error: error: Error: No resource found that matches the given name: attr 'searchViewCloseIcon'.

please let me know how to resolve this error .I really appreciate any help .Thanks in advance.

in styles.xml in values folder

<style name="Theme" parent="AppBaseTheme">
<item name="android:searchViewCloseIcon">@android:drawable/ic_search_close</item>
</style>

Solution

  • Try out as below:

     <item name="android:searchViewCloseIcon">@drawable/ic_search_close</item>