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

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

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

SearchView.setFocusable介绍

暂无

代码示例

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

searchView = (SearchView) searchItem.getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setFocusable(false);
searchView.setIconifiedByDefault(true);
searchView.setMaxWidth(Integer.MAX_VALUE);

代码示例来源:origin: raulh82vlc/Movies-Finder

public void claimSearchFocus() {
    if (mSearchView != null) {
      mSearchView.setFocusable(true);
    }
  }
}

代码示例来源:origin: MukeshKumar009/EcomSample

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater inflater = getMenuInflater();
  // Inflate menu to add items to action bar if it is present.
  inflater.inflate(R.menu.search_menu, menu);
  MenuItem searchItem = menu.getItem(0);
  // Associate searchable configuration with the SearchView
  SearchManager searchManager =
      (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  SearchView searchView =
      (SearchView) menu.findItem(R.id.action_search).getActionView();
  searchView.setSearchableInfo(
      searchManager.getSearchableInfo(getComponentName()));
  searchView.setFocusable(true);
  searchItem.expandActionView();
  return true;
}

代码示例来源:origin: 0xZhangKe/ShiZhong

private void setupSearchView(final SearchView searchView) {
  searchView.setIconified(true);
  searchView.setIconifiedByDefault(false);
  searchView.setSubmitButtonEnabled(true);
  searchView.setFocusable(true);
  searchView.requestFocusFromTouch();
  searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
    @Override
    public boolean onQueryTextSubmit(String query) {
      return false;
    }
    @Override
    public boolean onQueryTextChange(String newText) {
      curQueryText = newText;
      search();
      return true;
    }
  });
}

代码示例来源:origin: raulh82vlc/Movies-Finder

private void setSearchView(SearchManager searchManager, MenuItem searchItem) {
  mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
  if (mSearchView != null) {
    mSearchView.setIconified(false);
    mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
      @Override
      public boolean onQueryTextSubmit(String actualQuery) {
        if (mMoviesListFragment != null) {
          mMoviesListFragment.search(actualQuery);
        }
        return false;
      }
      @Override
      public boolean onQueryTextChange(String s) {
        return true;
      }
    });
    mSearchView.setFocusable(true);
  }
}

相关文章