android.view.Menu.setGroupVisible()方法的使用及代码示例

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

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

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

private void updateMenuVisibility() {
  if (optionsMenu != null) {
    if (slotManager.getSelectedSlot() == null) {
      optionsMenu.setGroupVisible(0, false);
    } else if (optionsMenu != null) {
      optionsMenu.setGroupVisible(0, true);
    }
  }
}

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

@Override
public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    menu.setGroupVisible(0, false);
}

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

@Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   menu.setGroupVisible(0,false);
   return true;
 }

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public void setGroupVisible(int group, boolean visible) {
  mNativeMenu.setGroupVisible(group, visible);
}

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

Menu drawerMenu = drawer.getMenu();
case R.id.action_venues:
 drawerMenu.setGroupVisible(R.id.group2,true);
case R.id.action_vendors:
 drawerMenu.setGroupVisible(R.id.group4,true);

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public void setGroupVisible(int group, boolean visible) {
  mNativeMenu.setGroupVisible(group, visible);
}

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

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
  inflater.inflate(R.menu.menu_grid_thumb, menu);

  menu.setGroupVisible(R.id.menu_grid_thumb, true);//this line to show menu of Fragment
  menu.setGroupVisible(R.id.menu_group_main, false);// this line to hide menu of Activity
  super.onCreateOptionsMenu(menu, inflater);
}

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

@Override
public boolean onCreateOptionsMenu(Menu menu){
     MenuInflater inflater = getMenuInflater();
     inflater.inflate(R.menu.custom_actionbar, menu);
     menu.setGroupVisible(...);
   }
 }

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.main_page_menu, menu);
  menu.setGroupVisible(R.id.menu_group_main, true); // this line to show menu of Activity

  return super.onCreateOptionsMenu(menu);
}

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

@Override
public boolean onCreateOptionsMenu(Menu menu){
     MenuInflater inflater = getMenuInflater();
     inflater.inflate(R.menu.custom_actionbar, menu);
     menu.setGroupVisible(R.id.main_menu_group,true);
   }
 }

代码示例来源:origin: realm/realm-android-adapters

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  this.menu = menu;
  getMenuInflater().inflate(R.menu.listview_options, menu);
  menu.setGroupVisible(R.id.group_normal_mode, true);
  menu.setGroupVisible(R.id.group_delete_mode, false);
  return true;
}

代码示例来源:origin: realm/realm-android-adapters

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  this.menu = menu;
  getMenuInflater().inflate(R.menu.listview_options, menu);
  menu.setGroupVisible(R.id.group_normal_mode, true);
  menu.setGroupVisible(R.id.group_delete_mode, false);
  return true;
}

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

public void displayAccounts(){
  nav.getMenu().setGroupVisible(R.id.drawer_accounts, true);
  nav.getMenu().setGroupVisible(R.id.drawer_navigation, false);
}

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

public void displayNavigation(){
  nav.getMenu().setGroupVisible(R.id.drawer_accounts, false);
  nav.getMenu().setGroupVisible(R.id.drawer_navigation, true);
}

代码示例来源:origin: Sea-n/Android-TG-Bot

@Override
  public void onClick(View view) {
    if (null == _bots)
      _bots = db.getBots();
    if (_bots.size() == 0) {
      Log.d("main", "no bot");
      askAddBot();
      return;
    }
    if (changeAccountMenuOpen) {
      restoreMenu();
    } else {
      menu.setGroupVisible(R.id.menu_api, false);
      accountItem.setVisible(true);
      changeAccountMenuOpen = true;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
        subtitle.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_up_black_24dp, 0);
    }
  }
});

代码示例来源:origin: realm/realm-android-adapters

@Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
      case R.id.action_add:
        DataHelper.addItemAsync(realm);
        return true;
      case R.id.action_random:
        DataHelper.randomAddItemAsync(realm);
        return true;
      case R.id.action_start_delete_mode:
        adapter.enableDeletionMode(true);
        menu.setGroupVisible(R.id.group_normal_mode, false);
        menu.setGroupVisible(R.id.group_delete_mode, true);
        return true;
      case R.id.action_end_delete_mode:
        DataHelper.deleteItemsAsync(realm, adapter.getCountersToDelete());
        // Fall through
      case R.id.action_cancel_delete_mode:
        adapter.enableDeletionMode(false);
        menu.setGroupVisible(R.id.group_normal_mode, true);
        menu.setGroupVisible(R.id.group_delete_mode, false);
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
}

代码示例来源:origin: realm/realm-android-adapters

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  int id = item.getItemId();
  switch(id) {
    case R.id.action_add:
      DataHelper.addItemAsync(realm);
      return true;
    case R.id.action_random:
      DataHelper.randomAddItemAsync(realm);
      return true;
    case R.id.action_start_delete_mode:
      adapter.enableDeletionMode(true);
      menu.setGroupVisible(R.id.group_normal_mode, false);
      menu.setGroupVisible(R.id.group_delete_mode, true);
      return true;
    case R.id.action_end_delete_mode:
      DataHelper.deleteItemsAsync(realm, adapter.getCountersToDelete());
      // Fall through
    case R.id.action_cancel_delete_mode:
      adapter.enableDeletionMode(false);
      menu.setGroupVisible(R.id.group_normal_mode, true);
      menu.setGroupVisible(R.id.group_delete_mode, false);
      return true;
    default:
      return super.onOptionsItemSelected(item);
  }
}

代码示例来源:origin: Sea-n/Android-TG-Bot

@Override
  public void run() {
    menu.setGroupVisible(R.id.menu_api, true);
    accountItem.setVisible(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
      subtitle.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down_black_24dp, 0);
    if (null == currentBot) {
      Log.d("main", "no bot on restore menu");
      askAddBot();
      return;
    }
    switch (currentBot.type) {
      case 0:
        caller.setEnabled(true);
        downloader.setEnabled(true);
        break;
      case 1:
      case 2:
        caller.setEnabled(false);
        downloader.setEnabled(false);
        break;
      default:
        Log.d("main", "Unknown type " + currentBot.type);
        break;
    }
  }
});

代码示例来源:origin: nvllsvm/Audinaut

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater menuInflater = getMenuInflater();
  SubsonicFragment currentFragment = getCurrentFragment();
  if (currentFragment != null) {
    try {
      SubsonicFragment fragment = getCurrentFragment();
      fragment.onCreateOptionsMenu(menu, menuInflater);
      if (isTouchscreen()) {
        menu.setGroupVisible(R.id.not_touchscreen, false);
      }
    } catch (Exception e) {
      Log.w(TAG, "Error on creating options menu", e);
    }
  }
  return true;
}

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

setTitle(null);
getMenu().setGroupVisible(R.id.normal_menu_group, false);
getMenu().setGroupVisible(R.id.selection_mode_menu_group, true);
setOverflowIcon(TintedDrawable.constructTintedDrawable(getResources(),
    R.drawable.btn_menu));
getMenu().setGroupVisible(R.id.normal_menu_group, true);
getMenu().setGroupVisible(R.id.selection_mode_menu_group, false);
setBackgroundColor(ApiCompatibilityUtils.getColor(getResources(),
    R.color.appbar_background));

相关文章