當前位置: 首頁>>代碼示例>>Java>>正文


Java SearchView.setImeOptions方法代碼示例

本文整理匯總了Java中android.support.v7.widget.SearchView.setImeOptions方法的典型用法代碼示例。如果您正苦於以下問題:Java SearchView.setImeOptions方法的具體用法?Java SearchView.setImeOptions怎麽用?Java SearchView.setImeOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.SearchView的用法示例。


在下文中一共展示了SearchView.setImeOptions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateOptionsMenu

import android.support.v7.widget.SearchView; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.fragment_category, menu);
    MenuItem item = menu.findItem(R.id.action_search);
    final SearchView searchView = (SearchView) item.getActionView();
    searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {

            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            mBookCategoryRecyclerViewAdapter.getFilter().filter(newText);
            return true;
        }
    });
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:22,代碼來源:BookCategoryFragment.java

示例2: setupSearchView

import android.support.v7.widget.SearchView; //導入方法依賴的package包/類
private void setupSearchView(MenuItem searchItem) {
    if (searchItem != null) {
        MenuItemCompat.setOnActionExpandListener(searchItem, this);
        SearchManager searchManager = (SearchManager) (getActivity()
                .getSystemService(Context.SEARCH_SERVICE));
        searchView = (SearchView) searchItem.getActionView();
        if (searchView != null) {
            searchView.setSearchableInfo(searchManager
                    .getSearchableInfo(getActivity().getComponentName()));
            searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
            searchView.clearFocus();
            searchView.setOnQueryTextListener(this);
            setupSearchOptions(searchView);
        }
    }
}
 
開發者ID:graviton57,項目名稱:TheNounProject,代碼行數:17,代碼來源:BaseSearchFragment.java

示例3: onCreateOptionsMenu

import android.support.v7.widget.SearchView; //導入方法依賴的package包/類
@Override public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.questions, menu);

  // Setup search widget in action bar
  SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
  searchView.setQueryHint(getString(R.string.search_hint));
  searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);

  searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
    @Override public boolean onQueryTextSubmit(String query) {
      return false;
    }

    @Override public boolean onQueryTextChange(String newText) {
      presenter.search(newText);
      return true;
    }
  });

  return true;
}
 
開發者ID:quangctkm9207,項目名稱:mvp-android-arch-component,代碼行數:22,代碼來源:QuestionsActivity.java


注:本文中的android.support.v7.widget.SearchView.setImeOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。