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

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

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

SearchView.setOnQueryTextFocusChangeListener介绍

暂无

代码示例

代码示例来源:origin: axxapy/apkExtractor

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.main, menu);
  SearchManager searchManager = (SearchManager)getSystemService(Context.SEARCH_SERVICE);
  final SearchView searchView = (SearchView)MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
  searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
    @Override
    public void onFocusChange(View view, boolean queryTextFocused) {
      if (!queryTextFocused && searchView.getQuery().length() < 1) {
        getSupportActionBar().collapseActionView();
      }
    }
  });
  searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
    @Override
    public boolean onQueryTextSubmit(String s) {
      return false;
    }
    @Override
    public boolean onQueryTextChange(String s) {
      apkListAdapter.setSearchPattern(s);
      return true;
    }
  });
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: avluis/Hentoid

mainSearchView.setQueryHint(getString(R.string.search_hint));
mainSearchView.setOnQueryTextFocusChangeListener((view, queryTextFocused) -> {
  View tagFilter = searchPane.findViewById(R.id.tag_filter);
  if (!queryTextFocused && tagFilter != null && !tagFilter.hasFocus()) {

代码示例来源:origin: tangqi92/BuildingBlocks

.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {

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

searchMenuItem = menu.findItem(R.id.menu_search);
searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {

代码示例来源:origin: Leaking/WeGit

searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {

相关文章