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

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

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

SearchView.post介绍

暂无

代码示例

代码示例来源:origin: pockethub/PocketHub

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case R.id.m_search:
      searchView.post(() -> searchView.setQuery(lastQuery, false));
      return true;
    case R.id.m_clear:
      RepositorySearchSuggestionsProvider.clear(this);
      ToastUtils.show(this, R.string.search_history_cleared);
      return true;
    case android.R.id.home:
      Intent intent = new Intent(this, MainActivity.class);
      intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
      startActivity(intent);
      return true;
    default:
      return super.onOptionsItemSelected(item);
  }
}

代码示例来源:origin: pockethub/PocketHub

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case R.id.m_search:
      searchView.post(() -> searchView.setQuery(lastQuery, false));
      return true;
    case R.id.m_clear:
      IssueSearchSuggestionsProvider.clear(this);
      ToastUtils.show(this, R.string.search_history_cleared);
      return true;
    case android.R.id.home:
      Intent intent = RepositoryViewActivity.createIntent(repository);
      intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
      startActivity(intent);
      return true;
    default:
      return super.onOptionsItemSelected(item);
  }
}

代码示例来源:origin: wallabag/android-app

private void initSearchUI() {
  final SearchView searchView = (SearchView)searchMenuItem.getActionView();
  if(searchView == null) return;
  final String searchQueryToRestore = searchQuery;
  MenuItemCompat.expandActionView(searchMenuItem);
  searchView.post(new Runnable() {
    @Override
    public void run() {
      Log.v(TAG, "searchView.post() restoring search string: " + searchQueryToRestore);
      searchView.setQuery(searchQueryToRestore, false);
    }
  });
}

代码示例来源:origin: konradrenner/kolabnotes-android

mSearchView.post(new Runnable() {
  @Override
  public void run() {

相关文章