搜索视图结果与键盘重叠

时间:2014-05-29 14:01:03

标签: android android-listview actionbarsherlock android-menu searchview

我正在使用actionbarsherlock searchview,如果我在建议视图中键入文本,我会在下拉菜单中获得一组结果,但如果我滚动建议,则整个建议视图会重叠在我的键盘上。如何防止这种

此处图片的外观如何

enter image description here

Menu.xml

<?xml version="1.0" encoding="utf-8"?>


android:title="@string/ManageList"
android:icon="@drawable/ic_launcher"
android:showAsAction="collapseActionView|always"
android:actionViewClass="com.actionbarsherlock.widget.SearchView"/>

这就是我活动中的菜单菜单。

  MenuInflater inflater = this.getSupportMenuInflater();
inflater.inflate(R.menu.menu_home_activity, menu);

        mSearchview = (SearchView) menu.findItem(R.id.search).getActionView();
        mSearchview.setImeOptions(EditorInfo.IME_ACTION_DONE);

        mSearchview.setFocusable(true);
        mSearchview.requestFocusFromTouch();

        if(mSearchadapter == null)
        {
            mSearchadapter = new SearchAdapter(getApplication(), null);
        }

        mSearchview.setSuggestionsAdapter(mSearchadapter);

        mSearchview.setOnQueryTextListener(new OnQueryTextListener() {

            @Override
            public boolean onQueryTextSubmit(String query) {
                // TODO Auto-generated method stub
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                // TODO Auto-generated method stub
               if(newText.trim().equals(""))
               {
                   return false;
               }

               Cursor c = TaskController.getDBManager().getAllTasksForSuggestedFilter(newText);

               mSearchadapter.changeCursor(c);

               return false;
            }
        });

0 个答案:

没有答案