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

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

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

SearchView.setImeOptions介绍

暂无

代码示例

代码示例来源:origin: derry/delion

mSearchView.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN);
SearchView.OnQueryTextListener queryTextListener =
    new SearchView.OnQueryTextListener() {

代码示例来源:origin: szpnygo/NoWordsChat

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.main, menu);
  SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
  SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  searchView.setQueryHint("搜索好友");
  searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
  searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
    @Override
    public boolean onQueryTextSubmit(String query) {
      startSearchActivity(query);
      return false;
    }
    @Override
    public boolean onQueryTextChange(String newText) {
      return false;
    }
  });
  return true;
}

代码示例来源:origin: materialos/android-icon-pack

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.zooper, menu);
  super.onCreateOptionsMenu(menu, inflater);
  MenuItem mSearchItem = menu.findItem(R.id.search);
  SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(mSearchItem);
  mSearchView.setQueryHint(getString(R.string.search_widgets));
  mSearchView.setOnQueryTextListener(this);
  mSearchView.setOnCloseListener(this);
  mSearchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
  if (getActivity() != null) {
    final MainActivity act = (MainActivity) getActivity();
    TintUtils.themeSearchView(act.getToolbar(), mSearchView, DialogUtils.resolveColor(act, R.attr.tab_icon_color));
  }
}

代码示例来源:origin: szpnygo/NoWordsChat

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.search, menu);
  menu.findItem(R.id.action_search).expandActionView();
  mSearchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
  mSearchView.setQueryHint("搜索好友");
  mSearchView.setQuery(getIntent().getStringExtra("query"), true);
  mSearchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
  mSearchView.setIconifiedByDefault(true);
  mSearchView.setIconified(false);
  mSearchView.clearFocus();
  mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
    @Override
    public boolean onQueryTextSubmit(String query) {
      presenter.search(query);
      return false;
    }
    @Override
    public boolean onQueryTextChange(String newText) {
      return false;
    }
  });
  presenter.search(getQuery());
  return true;
}

代码示例来源:origin: materialos/android-icon-pack

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.icons, menu);
  super.onCreateOptionsMenu(menu, inflater);
  MenuItem mSearchItem = menu.findItem(R.id.search);
  SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(mSearchItem);
  mSearchView.setQueryHint(getString(R.string.search_icons));
  mSearchView.setOnQueryTextListener(this);
  mSearchView.setOnCloseListener(this);
  mSearchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
  if (getActivity() != null) {
    final BaseThemedActivity act = (BaseThemedActivity) getActivity();
    TintUtils.themeSearchView(act.getToolbar(), mSearchView, DialogUtils.resolveColor(act, R.attr.tab_icon_color));
  }
}

代码示例来源:origin: materialos/android-icon-pack

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.wallpapers, menu);
  super.onCreateOptionsMenu(menu, inflater);
  MenuItem mSearchItem = menu.findItem(R.id.search);
  SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(mSearchItem);
  mSearchView.setQueryHint(getString(R.string.search_wallpapers));
  mSearchView.setOnQueryTextListener(this);
  mSearchView.setOnCloseListener(this);
  mSearchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
  if (getActivity() != null) {
    final MainActivity act = (MainActivity) getActivity();
    TintUtils.themeSearchView(act.getToolbar(), mSearchView, DialogUtils.resolveColor(act, R.attr.tab_icon_color));
  }
}

代码示例来源:origin: materialos/android-icon-pack

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.kustom, menu);
  super.onCreateOptionsMenu(menu, inflater);
  MenuItem mSearchItem = menu.findItem(R.id.search);
  SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(mSearchItem);
  mSearchView.setQueryHint(getString(getSearchHintRes()));
  mSearchView.setOnQueryTextListener(this);
  mSearchView.setOnCloseListener(this);
  mSearchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
  if (getActivity() != null) {
    final MainActivity act = (MainActivity) getActivity();
    TintUtils.themeSearchView(act.getToolbar(), mSearchView, DialogUtils.resolveColor(act, R.attr.tab_icon_color));
  }
}

代码示例来源:origin: anitaa1990/TrailersApp

private void initialiseView() {
  binding = DataBindingUtil.setContentView(this, R.layout.activity_search);
  SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  binding.search.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  binding.search.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
  binding.search.setIconifiedByDefault(false);
  binding.search.setOnQueryTextListener(this);
  EditText searchEditText = binding.search.findViewById(android.support.v7.appcompat.R.id.search_src_text);
  searchEditText.setTextColor(getResources().getColor(android.R.color.white));
  searchEditText.setHintTextColor(getResources().getColor(android.R.color.white));
  Typeface myCustomFont = ResourcesCompat.getFont(getApplicationContext(), R.font.gt_medium);
  searchEditText.setTypeface(myCustomFont);
  searchListAdapter = new MovieSearchListAdapter(this);
  binding.includedLayout.moviesList.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false));
  binding.includedLayout.moviesList.setAdapter(searchListAdapter);
  SnapHelper startSnapHelper = new PagerSnapHelper(position -> {
    MovieEntity trailer = searchListAdapter.getItem(position);
    updateBackground(trailer.getPosterPath());
  });
  startSnapHelper.attachToRecyclerView(binding.includedLayout.moviesList);
  binding.includedLayout.moviesList.addOnItemTouchListener(new RecyclerItemClickListener(getApplicationContext(), this));
}

代码示例来源:origin: anitaa1990/TrailersApp

private void initialiseView() {
  binding = DataBindingUtil.setContentView(this, R.layout.activity_search);
  SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  binding.search.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  binding.search.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
  binding.search.setIconifiedByDefault(false);
  binding.search.setOnQueryTextListener(this);
  EditText searchEditText = binding.search.findViewById(android.support.v7.appcompat.R.id.search_src_text);
  searchEditText.setTextColor(getResources().getColor(android.R.color.white));
  searchEditText.setHintTextColor(getResources().getColor(android.R.color.white));
  Typeface myCustomFont = ResourcesCompat.getFont(getApplicationContext(), R.font.gt_medium);
  searchEditText.setTypeface(myCustomFont);
  searchListAdapter = new TvSearchListAdapter(this);
  binding.includedLayout.moviesList.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false));
  binding.includedLayout.moviesList.setAdapter(searchListAdapter);
  SnapHelper startSnapHelper = new PagerSnapHelper(position -> {
    TvEntity trailer = searchListAdapter.getItem(position);
    updateBackground(trailer.getPosterPath());
  });
  startSnapHelper.attachToRecyclerView(binding.includedLayout.moviesList);
  binding.includedLayout.moviesList.addOnItemTouchListener(new RecyclerItemClickListener(getApplicationContext(), this));
}

代码示例来源:origin: jahirfiquitiva/IconShowcase

mSearchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
ToolbarTinter.on(menu)
    .setIconsColor(ThemeUtils.darkOrLight(getActivity(),

相关文章