Android SearchView setOnActionExpandListener doesn't work

I solved the problem: the onActionExpandListener works only if the ActionView of my MenuItem is marked also as collapseActionView in my menu file. So I modified it in this way:

<item 
  android:id="@+id/search"
  android:title="@string/search_title"
  android:orderInCategory="1"
  android:icon="@android:drawable/ic_menu_search"
  app:showAsAction="ifRoom|collapseActionView"
  app:actionViewClass="android.widget.SearchView"  />