Clear button still showing after HC searchView aproach


#1

Hi,

I’m following your book step by step, however, can’t find what I’m doing wrong.
After the implementation of Honeycomb approach to show a search view the clear button (the icon with x) remains displayed on the right side of my action bar, but in the book’s illustration it’s not there, producing a better result. What am I missing? Any clues?

Thank you!


#2

A brief update:

I’m using an LG Nexus with version 4.2.2 of android.
Today I tested the same application on a Samsung S3 with android 4.1.2 and the problem did not occur.

Any suggestions?


#3

I just had this problem both on my Lollipop device as well as a 4.1.1 emulator. I just added one line to the end of onCreateOptionsMenu() to hide the clear button when SearchView action view is used.

menu.findItem(R.id.menu_item_clear).setVisible(false);