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

x33g5p2x  于2022-01-30 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(120)

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

SearchView.requestFocusFromTouch介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
 searchView.setIconifiedByDefault(true);
 searchView.setFocusable(true);
 searchView.setIconified(false);
 searchView.requestFocusFromTouch();

代码示例来源:origin: stackoverflow.com

public void onCreate(Bundle savedInstanceState)
{
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  ActionBar actionBar = getActionBar();
  SearchView searchView = new SearchView(this);
  actionBar.setCustomView(searchView);
  actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
  searchView.setQuery("test",true);
  searchView.setFocusable(true);
  searchView.setIconified(false);
  searchView.requestFocusFromTouch();
}

代码示例来源:origin: WeAreFairphone/FP2-Launcher

@Override
public void onAnimationEnd(Animation animation) {
  mSearchView.setLayerType(View.LAYER_TYPE_NONE, null);
  mDrawerView.setLayerType(View.LAYER_TYPE_NONE, null);
  mAnimating = false;
  mActive = true;
  mSearchView.requestFocusFromTouch();
}

代码示例来源:origin: stackoverflow.com

final SearchView sv = new SearchView(((MainActivity) getActivity()).getSupportActionBar().getThemedContext());
   sv.setIconifiedByDefault(true);
   sv.setFocusable(true);
   sv.setIconified(false);
   sv.clearFocus();
   sv.requestFocusFromTouch();

代码示例来源:origin: stackoverflow.com

SearchView searchView = (SearchView)  
 menu.findItem(R.id.action_search).getActionView();
 searchView.setIconifiedByDefault(true);
 searchView.setFocusable(true);
 searchView.setIconified(false);
 searchView.requestFocusFromTouch();

代码示例来源:origin: stackoverflow.com

private SearchView mSearchView;

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.main, menu);

  SearchManager searchManager =
      (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  MenuItem searchItem = menu.findItem(R.id.action_search);
  mSearchView =
      (SearchView) searchItem.getActionView();
  mSearchView.setSearchableInfo(
      searchManager.getSearchableInfo(getComponentName()));

  return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  int id = item.getItemId();
  if (id == R.id.action_search) {
    mSearchView.setIconifiedByDefault(true);
    mSearchView.setFocusable(true);
    mSearchView.setIconified(false);
    mSearchView.requestFocusFromTouch();
  }

  return super.onOptionsItemSelected(item);
}

代码示例来源:origin: stackoverflow.com

searchView.setFocusableInTouchMode(true);
searchView.requestFocus();
searchView.requestFocusFromTouch();

代码示例来源:origin: stackoverflow.com

MenuItem searchMenuItem = menu.findItem(R.id.action_search);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchMenuItem.expandActionView();   searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  searchView.setIconifiedByDefault(false);
  searchView.setFocusable(true);
  searchView.setIconified(false);
  searchView.requestFocusFromTouch();

代码示例来源:origin: stackoverflow.com

sv.setIconified(false);
sv.clearFocus();
sv.requestFocusFromTouch();
    sv.setFocusable(true);
    sv.setIconified(false);
    sv.requestFocusFromTouch();
    return false;

代码示例来源:origin: IHTSDO/SNOMED-in-5-minutes

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
  // Inflate the layout for this fragment
  View view = inflater.inflate(R.layout.fragment_snomed, container, false);
  unbinder = ButterKnife.bind(this, view);
  adapter = new SnomedAdapter(getContext(), getActivity());
  rvJsonResponse.setEmptyView(view.findViewById(R.id.empty_rv_view));
  tvSearchBar.setQueryHint("Type at least 3 characters  Example: shou fra");
  tvSearchBar.setOnClickListener(v -> {
    tvSearchBar.setFocusable(true);
    tvSearchBar.setIconified(false);
    tvSearchBar.requestFocusFromTouch();
  });
  tvSearchBar.setOnQueryTextListener(this);
  rvJsonResponse.setLayoutManager(new LinearLayoutManager(getContext()));
  rvJsonResponse.setAdapter(adapter);
  rvJsonResponse.setNestedScrollingEnabled(false);
  return view;
}

代码示例来源:origin: stackoverflow.com

searchView.setFocusableInTouchMode(true);
searchView.requestFocus();
searchView.requestFocusFromTouch();

相关文章