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

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

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

SearchView.setVisibility介绍

暂无

代码示例

代码示例来源:origin: RedInput/Notification-Blocker

private void showApps() {
  recyclerView.setVisibility(View.VISIBLE);
  searchView.setVisibility(View.VISIBLE);
  empty.setVisibility(View.GONE);
}

代码示例来源:origin: RedInput/Notification-Blocker

private void hideApps() {
  recyclerView.setVisibility(View.GONE);
  searchView.setVisibility(View.GONE);
  empty.setVisibility(View.VISIBLE);
}

代码示例来源:origin: TeamWalrus/Walrus

@Override
public void onBackPressed() {
  if (sv.getVisibility() != View.GONE) {
    sv.setIconified(true);
    sv.setVisibility(View.GONE);
  } else {
    super.onBackPressed();
  }
}

代码示例来源:origin: vanilla-music/vanilla

/**
 * Sets the search view to given state
 *
 * @param visible enables or disables the search box visibility
 * @return boolean old state
 */
public boolean showSearch(boolean visible) {
  boolean wasVisible = mSearchView.getVisibility() == View.VISIBLE;
  if (wasVisible != visible) {
    mSearchView.setVisibility(visible ? View.VISIBLE : View.GONE);
    mControlsContent.setVisibility(visible ? View.GONE : View.VISIBLE);
    if (visible)
      mSearchView.setIconified(false); // requests focus AND shows the soft keyboard even if the view already was expanded
    else
      mSearchView.setQuery("", false);
  }
  return wasVisible;
}

代码示例来源:origin: TeamWalrus/Walrus

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case R.id.search:
      sv.setVisibility(View.VISIBLE);
      sv.requestFocus();
      return true;
    case R.id.bulk_read_cards:
      startActivity(new Intent(this, BulkReadCardsActivity.class));
      return true;
    case R.id.devices:
      startActivity(new Intent(this, DevicesActivity.class));
      return true;
    case R.id.settings:
      startActivity(new Intent(this, SettingsActivity.class));
      return true;
    default:
      return super.onOptionsItemSelected(item);
  }
}

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

@Override
public void onAnimationEnd(Animation animation) {
  mSearchView.setLayerType(View.LAYER_TYPE_NONE, null);
  mSearchView.setVisibility(View.GONE);
  View scrollView = mDrawerView.findViewById(R.id.agingDrawerScroll);
  scrollView.scrollTo(0, 0);
  Animation fadeOut = AnimationUtils.loadAnimation(mLauncher.getApplicationContext(), R.anim.fade_in_slow);
  fadeOut.setFillAfter(true);
  fadeOut.setAnimationListener(new Animation.AnimationListener() {
    @Override
    public void onAnimationStart(Animation animation) {
    }
    @Override
    public void onAnimationEnd(Animation animation) {
      mDrawerView.setLayerType(View.LAYER_TYPE_NONE, null);
      mActive = false;
      mAnimating = false;
    }
    @Override
    public void onAnimationRepeat(Animation animation) {
    }
  });
  View agingAppsMenuIcon = mDrawerView.findViewById(R.id.aging_drawer_menu_btn);
  View searchButton = mDrawerView.findViewById(R.id.all_apps_search_btn);
  agingAppsMenuIcon.startAnimation(fadeOut);
  searchButton.startAnimation(fadeOut);
}

代码示例来源:origin: SunAlwaysOnline/Sukeda

public void onBackPressed() {
  int count = getSupportFragmentManager().getBackStackEntryCount();
  if (count == 1) {
    String tag = getSupportFragmentManager().getBackStackEntryAt(0).getName();
    super.onBackPressed();
    searchView.setVisibility(View.VISIBLE);
    searchView.clearFocus();
    recyclerView.setVisibility(View.VISIBLE);
    if (tag != null && tag.equals("detail")) {
      return;
    }
    if (abl_library != null) {
      setAblExpanded(true);
    }
    return;
  }
  if (count == 0) {
    if (abl_state != STATE.EXPANDED) {
      setAblExpanded(true);
    } else {
      startActivity(new Intent(LibraryActivity.this, HomeActivity.class));
      overridePendingTransition(R.anim.in_from_left, R.anim.out_to_right);
      super.onBackPressed();
    }
  }
}

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

mSearchView.setVisibility(View.VISIBLE);
mSearchView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
Animation searchAppear = AnimationUtils.loadAnimation(mLauncher.getApplicationContext(), R.anim.search_appear);

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

searchView.setVisibility(View.INVISIBLE);
searchView.setVisibility(View.VISIBLE);

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

mSearch.setVisibility(View.GONE);
mSearch.setVisibility(View.VISIBLE);

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

searchView.setVisibility(View.INVISIBLE);
searchView.setVisibility(View.VISIBLE);

相关文章