0

I have just added a SearchView to my app, and everything is working great, however the icon is acting strangely.

This is how it is currently:

enter image description here

However obviously this is how I want it to look:

enter image description here

As you can see, I've managed to get it to appear properly by changing the last line of this:

<item
    android:id="@+id/action_search"
    android:icon="@android:drawable/ic_menu_search"
    android:title="@string/action_search"
    app:actionViewClass="android.support.v7.widget.SearchView"
    app:showAsAction="always|collapseActionView" />

To this:

    app:showAsAction="always" />

However, the problem with this is that when I search, the item on the left does not change to a back button like it should:

enter image description here

This is what I want:

enter image description here

Anyone have any suggestions?

user3746428
  • 11,047
  • 20
  • 81
  • 137
  • 1
    Have a look at this one http://stackoverflow.com/questions/27556623/creating-a-searchview-that-looks-like-the-material-design-guidelines – issathink Mar 05 '16 at 23:21
  • Awesome! I had tried looking up an existing answer, but I didn't find anything. Thanks a lot! – user3746428 Mar 05 '16 at 23:24

0 Answers0