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

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

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

SearchView.setFocusable介绍

暂无

代码示例

代码示例来源: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

(SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView=(SearchView) findViewById(R.id.searchbox);
searchView.setFocusable(true);// searchView is null
searchView.setFocusableInTouchMode(true);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

代码示例来源: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: stackoverflow.com

SearchView searchView = new SearchView(context);
searchView.setQueryHint(strHint);
searchView.setFocusable(true);
searchView.setFocusableInTouchMode(true);
searchView.requestFocus();

代码示例来源: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 = new SearchView(context);
searchView.setQueryHint(strHint);
searchView.setFocusable(true);
searchView.setFocusableInTouchMode(true);
searchView.requestFocus();

代码示例来源: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

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.setFocusable(true);
sv.setIconified(false);
sv.clearFocus();
  public boolean onMenuItemClick(MenuItem item) {
    sv.setIconifiedByDefault(true);
    sv.setFocusable(true);
    sv.setIconified(false);
    sv.requestFocusFromTouch();

代码示例来源: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: ValueYouth/RhymeMusic

private void initComponents()
  {
    application = (MusicApplication) getApplication();

    /*搜索结果为空时,显示的提示信息*/
    textTips = (TextView) findViewById(R.id.text_tips);

    /*按钮类组件初始化*/
    searchBack = (ImageButton) findViewById(R.id.image_search_back);
    searchOption = (ImageButton) findViewById(R.id.image_search_option);
    searchBack.setOnClickListener(this);
    searchOption.setOnClickListener(this);

    /*列表组件初始化*/
    listView = (ListView) findViewById(R.id.list_search_result);
    listView.setOnItemClickListener(this);
    listView.setVisibility(View.INVISIBLE);
    loadData();

    /*搜索组件初始化*/
    searchView = (SearchView) findViewById(R.id.view_search);
    searchView.setOnQueryTextListener(this);
    searchView.onActionViewExpanded(); // 默认出现点击输入状态
    searchView.setFocusable(false);
    searchView.clearFocus();
//        searchView.setSubmitButtonEnabled(true);

  }

相关文章