searchManager.getSearchableInfo(getComponentName()) returns null

后端 未结 3 896
有刺的猬
有刺的猬 2021-01-11 13:03

I\'ve followed this Android guide in order to add a search bar to an activity. The setup looks like this:

res/menu/activity_main.xml:



        
3条回答
  •  悲哀的现实
    2021-01-11 13:37

    In my case the problem was my mistake during integration with ActionBarSherlock. In this case android:actionViewClass should be com.actionbarsherlock.widget.SearchView instead of android.widget.SearchView. I know this sounds dumb, but I spent 20 minutes trying to figure out why searchView is null in my code that is similar to yours.

提交回复
热议问题