android.view.MenuItem.setVisible()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(233)

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

暂无

代码示例

代码示例来源:origin: k9mail/k-9

public void showSelectAll(boolean show) {
  if (actionMode != null) {
    mSelectAll.setVisible(show);
  }
}

代码示例来源:origin: k9mail/k-9

public void showFlag(boolean show) {
  if (actionMode != null) {
    mFlag.setVisible(show);
    mUnflag.setVisible(!show);
  }
}

代码示例来源:origin: commonsguy/cw-omnibus

private void pause() {
 mp.pause();
 play.setVisible(true);
 pause.setVisible(false);
 stop.setVisible(true);
}

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

public boolean onPrepareOptionsMenu(Menu menu)
{
  MenuItem register = menu.findItem(R.id.menuregistrar);      
  if(userRegistered) 
  {           
    register.setVisible(false);
  }
  else
  {
    register.setVisible(true);
  }
  return true;
}

代码示例来源:origin: commonsguy/cw-omnibus

private void play() {
 mp.start();
 play.setVisible(false);
 pause.setVisible(true);
 stop.setVisible(true);
}

代码示例来源:origin: nostra13/Android-Universal-Image-Loader

@Override
public void onPrepareOptionsMenu(Menu menu) {
  MenuItem pauseOnScrollItem = menu.findItem(R.id.item_pause_on_scroll);
  pauseOnScrollItem.setVisible(true);
  pauseOnScrollItem.setChecked(pauseOnScroll);
  MenuItem pauseOnFlingItem = menu.findItem(R.id.item_pause_on_fling);
  pauseOnFlingItem.setVisible(true);
  pauseOnFlingItem.setChecked(pauseOnFling);
}

代码示例来源:origin: naman14/Timber

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  MenuItem item = menu.findItem(R.id.action_search);
  item.setVisible(false);
  return true;
}

代码示例来源:origin: commonsguy/cw-omnibus

private void updateMenu() {
 if (menu != null) {
  menu.findItem(R.id.stop).setVisible(client != null && isPlaying);
  menu.findItem(R.id.pause).setVisible(client != null && isPlaying
                       && !isPaused);
  menu.findItem(R.id.play)
    .setVisible(client != null && (!isPlaying || isPaused));
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

private void updateMenu() {
 if (menu != null) {
  menu.findItem(R.id.stop).setVisible(client != null && isPlaying);
  menu.findItem(R.id.pause).setVisible(client != null && isPlaying
                       && !isPaused);
  menu.findItem(R.id.play)
    .setVisible(client != null && (!isPlaying || isPaused));
 }
}

代码示例来源:origin: Yalantis/uCrop

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  menu.findItem(R.id.menu_crop).setVisible(!mShowLoader);
  menu.findItem(R.id.menu_loader).setVisible(mShowLoader);
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: naman14/Timber

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  if (action.equals(Constants.NAVIGATE_PLAYLIST_USERCREATED)) {
    menu.findItem(R.id.action_delete_playlist).setVisible(true);
    menu.findItem(R.id.action_clear_auto_playlist).setVisible(false);
  } else {
    menu.findItem(R.id.action_delete_playlist).setVisible(false);
    menu.findItem(R.id.action_clear_auto_playlist).setTitle("Clear " + playlistname.getText().toString());
  }
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: TeamNewPipe/NewPipe

private void updateMenuItemVisibility() {
  // show kodi if set in settings
  menu.findItem(R.id.action_play_with_kodi).setVisible(
      PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(
          activity.getString(R.string.show_play_with_kodi_key), false));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void run() {
  try {
   mp.prepare();
   mp.seekTo(0);
   play.setVisible(true);
  }
  catch (Exception e) {
   goBlooey(e);
  }
 }
}, 100);

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onMultiWindowModeChanged(boolean inMultiWindow) {
 super.onMultiWindowModeChanged(inMultiWindow);
 if (launchItem!=null) {
  launchItem.setVisible(inMultiWindow);
 }
}

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

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  MenuItem followItem = menu.findItem(R.id.m_star);
  followItem.setVisible(starredStatusChecked);
  followItem.setTitle(isStarred ? R.string.unstar : R.string.star);
  MenuItem parentRepo = menu.findItem(R.id.m_parent_repo);
  if(repository != null && repository.isFork() != null)
    parentRepo.setVisible(repository.isFork());
  return super.onPrepareOptionsMenu(menu);
}

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

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  MenuItem followItem = menu.findItem(R.id.m_follow);
  boolean isCurrentUser = user.login().equals(AccountUtils.getLogin(this));
  followItem.setVisible(followingStatusChecked && !isCurrentUser);
  followItem.setTitle(isFollowing ? R.string.unfollow : R.string.follow);
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onCreateOptionsMenu(Menu menu,
                MenuInflater inflater) {
 inflater.inflate(R.menu.editor_actions, menu);
 if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.N) {
  launchItem=menu.findItem(R.id.launch);
  launchItem.setVisible(getActivity().isInMultiWindowMode());
 }
 super.onCreateOptionsMenu(menu, inflater);
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onCreateOptionsMenu(Menu menu) {
 new MenuInflater(this).inflate(R.menu.actions, menu);
 MenuItem item=menu.findItem(getOwnMenuId());
 if (item!=null) {
  item.setVisible(false);
 }
 return(super.onCreateOptionsMenu(menu));
}

代码示例来源:origin: TeamNewPipe/NewPipe

public void applyChanges() {
  mIterator.start();
  DiffUtil.calculateDiff(mIterator, true).dispatchUpdatesTo(this);
  mIterator.end();
  checkEmptyMessageVisibility();
  if (mClear != null) mClear.setVisible(mIterator.hasFinishedMissions());
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldAllowSettingVisible() throws Exception {
 assertThat(item.isVisible()).isTrue();
 item.setVisible(false);
 assertThat(item.isVisible()).isFalse();
}

相关文章