SearchView 未在文本更改侦听器或文本提交中显示任何结果

SearchView not showing any results in Text Change Listener or Text Submit

我正在尝试在 FragmentOptionsMenu 中实现 SearchViewonQueryTextChangeonQueryTextSubmit 不工作。我不确定我哪里出错了。

菜单文件:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/profile"
        android:orderInCategory="10"
        android:title="Profile"
        app:showAsAction="never">
    </item>
    <item
        android:id="@+id/settings"
        android:orderInCategory="11"
        android:title="Settings"
        app:showAsAction="never">
    </item>
    <item
        android:id="@+id/action_search"
        android:icon="@android:drawable/ic_menu_search"
        app:showAsAction="always|collapseActionView"
        app:actionViewClass="android.support.v7.widget.SearchView"
        android:title="Search"/>
</menu>

片段中我试图从 SearchView 访问文本的部分:

@Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.browse_story_fragment, menu);

        MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
        searchView = (SearchView) myActionMenuItem.getActionView();

        SearchView.OnQueryTextListener listener = new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextChange(String query) {
                query = query.toLowerCase();

                Log.e("queryText",query);

                return false;

            }
            public boolean onQueryTextSubmit(String query) {
                Log.e("queryTextSubmit", query);
                return false;
            }
        };

        super.onCreateOptionsMenu(menu, inflater);
    }

我在日志中没有看到任何内容。我哪里错了?

我的大错!我在想什么!

代码如下:

@Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.browse_story_fragment, menu);

        MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
        searchView = (SearchView) myActionMenuItem.getActionView();

        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

            @Override
            public boolean onQueryTextSubmit(String query) {
                // collapse the view ?
                //menu.findItem(R.id.menu_search).collapseActionView();
                Log.e("queryText",query);
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                // search goes here !!
                // listAdapter.getFilter().filter(query);
                Log.e("queryText",newText);
                return false;
            }


    });
        super.onCreateOptionsMenu(menu, inflater);
    }