android.support.v7.widget.SearchView.setOnSuggestionListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中android.support.v7.widget.SearchView.setOnSuggestionListener()方法的一些代码示例,展示了SearchView.setOnSuggestionListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SearchView.setOnSuggestionListener()方法的具体详情如下:
包路径:android.support.v7.widget.SearchView
类名称:SearchView
方法名:setOnSuggestionListener

SearchView.setOnSuggestionListener介绍

暂无

代码示例

代码示例来源:origin: guanpj/JReadHub

private void initSuggestionData(Cursor cursor) {
  mSearchView.setSuggestionsAdapter(new SimpleCursorAdapter(getContext(), R.layout.item_search_suggestion,
      cursor, new String[] {"keyWord"}, new int[] {R.id.txt_sug}, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER));
  mSearchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
    @Override
    public boolean onSuggestionSelect(int position) {
      return false;
    }
    @Override
    public boolean onSuggestionClick(int position) {
      cursor.moveToPosition(position);
      mSearchView.setQuery(cursor.getString(cursor.getColumnIndex("keyWord")), true);
      mSearchView.clearFocus();
      if (!cursor.isClosed()) {
        cursor.close();
      }
      return true;
    }
  });
}

代码示例来源:origin: tomahawk-player/tomahawk-android

searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
  @Override
  public boolean onSuggestionSelect(int position) {

代码示例来源:origin: rsiebert/TVHClient

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  super.onCreateOptionsMenu(menu);
  getMenuInflater().inflate(R.menu.main_options_menu, menu);
  mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
  try {
    CastButtonFactory.setUpMediaRouteButton(getApplicationContext(), menu, R.id.media_route_menu_item);
  } catch (Exception e) {
    Timber.e("Could not setup media route button", e);
  }
  SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  if (searchManager != null) {
    searchMenuItem = menu.findItem(R.id.menu_search);
    searchView = (SearchView) searchMenuItem.getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true);
    searchView.setOnQueryTextListener(this);
    searchView.setOnSuggestionListener(this);
    Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.main);
    if (fragment instanceof SearchRequestInterface
        && fragment.isVisible()) {
      searchView.setQueryHint(((SearchRequestInterface) fragment).getQueryHint());
    }
  }
  return true;
}

代码示例来源:origin: Phantast/smartnavi

searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {

代码示例来源:origin: jtmcn/archwiki-viewer

searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
  @Override
  public boolean onSuggestionSelect(int position) {

相关文章