本文整理了Java中android.view.Menu.setGroupCheckable()
方法的一些代码示例,展示了Menu.setGroupCheckable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.setGroupCheckable()
方法的具体详情如下:
包路径:android.view.Menu
类名称:Menu
方法名:setGroupCheckable
暂无
代码示例来源:origin: TeamNewPipe/NewPipe
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
ActionBar supportActionBar = activity.getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayShowTitleEnabled(false);
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
menuItemToFilterName = new HashMap<>();
int itemId = 0;
boolean isFirstItem = true;
final Context c = getContext();
for(String filter : service.getSearchQHFactory().getAvailableContentFilter()) {
menuItemToFilterName.put(itemId, filter);
MenuItem item = menu.add(1,
itemId++,
0,
ServiceHelper.getTranslatedFilterString(filter, c));
if(isFirstItem) {
item.setChecked(true);
isFirstItem = false;
}
}
menu.setGroupCheckable(1, true, true);
restoreFilterChecked(menu, filterItemCheckedId);
}
代码示例来源:origin: com.actionbarsherlock/actionbarsherlock
@Override
public void setGroupCheckable(int group, boolean checkable, boolean exclusive) {
mNativeMenu.setGroupCheckable(group, checkable, exclusive);
}
代码示例来源:origin: com.willowtreeapps/oak-demos
@Override
public void setGroupCheckable(int group, boolean checkable, boolean exclusive) {
mNativeMenu.setGroupCheckable(group, checkable, exclusive);
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
@Override
public void inflateWalkingModeMenu(Menu menu) {
// Add the walking modes to option menu
menu.clear();
menuWalkingModes = new HashMap<>();
List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(getContext());
int i = 0;
for (WalkingMode walkingMode : walkingModes) {
int id = Menu.FIRST + (i++);
menuWalkingModes.put(id, walkingMode);
menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
}
menu.setGroupCheckable(0, true, true);
}
代码示例来源:origin: stackoverflow.com
menu.setGroupCheckable(R.id.group, true, true);
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
@Override
public void inflateWalkingModeMenu(Menu menu) {
// Add the walking modes to option menu
menu.clear();
menuWalkingModes = new HashMap<>();
List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(getContext());
int i = 0;
for (WalkingMode walkingMode : walkingModes) {
int id = Menu.FIRST + (i++);
menuWalkingModes.put(id, walkingMode);
menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
}
menu.setGroupCheckable(0, true, true);
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// Add the walking modes to option menu
menu.clear();
menuWalkingModes = new HashMap<>();
List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(this);
int i = 0;
for (WalkingMode walkingMode : walkingModes) {
int id = Menu.FIRST + (i++);
menuWalkingModes.put(id, walkingMode);
menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
}
menu.setGroupCheckable(0, true, true);
return super.onPrepareOptionsMenu(menu);
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// Add the walking modes to option menu
menu.clear();
menuWalkingModes = new HashMap<>();
List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(this);
int i = 0;
for (WalkingMode walkingMode : walkingModes) {
int id = Menu.FIRST + (i++);
menuWalkingModes.put(id, walkingMode);
menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
}
menu.setGroupCheckable(0, true, true);
return super.onPrepareOptionsMenu(menu);
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// Add the walking modes to option menu
menu.clear();
menuWalkingModes = new HashMap<>();
List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(this);
int i = 0;
for (WalkingMode walkingMode : walkingModes) {
int id = Menu.FIRST + (i++);
menuWalkingModes.put(id, walkingMode);
menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
}
menu.setGroupCheckable(0, true, true);
return super.onPrepareOptionsMenu(menu);
}
代码示例来源:origin: nvllsvm/Audinaut
private void populateServers() {
drawerList.getMenu().clear();
int serverCount = Util.getServerCount(this);
int activeServer = Util.getActiveServer(this);
for (int i = 1; i <= serverCount; i++) {
MenuItem item = drawerList.getMenu().add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_BASE + i, MENU_ITEM_SERVER_BASE + i, Util.getServerName(this, i));
if (activeServer == i) {
item.setChecked(true);
}
}
drawerList.getMenu().setGroupCheckable(MENU_GROUP_SERVER, true, true);
drawerHeaderToggle.setImageResource(R.drawable.main_select_tabs_dark);
showingTabs = false;
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
@Override
public void inflateWalkingModeMenu(Menu menu) {
// Add the walking modes to option menu
menu.clear();
menuWalkingModes = new HashMap<>();
List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(getContext());
int i = 0;
for (WalkingMode walkingMode : walkingModes) {
int id = Menu.FIRST + (i++);
menuWalkingModes.put(id, walkingMode);
menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
}
menu.add(1, Menu.FIRST + i, Menu.NONE, getString(R.string.correct_steps)).setCheckable(false);
menuCorrectStepId = Menu.FIRST + i;
menu.setGroupCheckable(0, true, true);
}
代码示例来源:origin: fire3/sailorcast
public void showVerboseLogPopup(View v) {
PopupMenu popup = new PopupMenu(this, v);
Menu menu = popup.getMenu();
menu.add(Menu.NONE, 0, Menu.NONE, R.string.logging_normal);
menu.add(Menu.NONE, 1, Menu.NONE, R.string.logging_verbose);
menu.setGroupCheckable(Menu.NONE, true, true);
menu.findItem((VerboseLogUtil.areAllTagsEnabled()) ? 1 : 0).setChecked(true);
popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == 0) {
VerboseLogUtil.setEnableAllTags(false);
} else {
VerboseLogUtil.setEnableAllTags(true);
}
return true;
}
});
popup.show();
}
代码示例来源:origin: karanvs/ExVidPlayer
@Override public void setQuality(View v) {
PopupMenu popup = new PopupMenu(activity, v);
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override public boolean onMenuItemClick(MenuItem item) {
player.setSelectedTrack(0, (item.getItemId() - 1));
return false;
}
});
ArrayList<Integer> formats = new ArrayList<>();
Menu menu = popup.getMenu();
menu.add(Menu.NONE, 0, 0, "Bitrate");
for (int i = 0; i < player.getTrackCount(0); i++) {
MediaFormat format = player.getTrackFormat(0, i);
if (MimeTypes.isVideo(format.mimeType)) {
Log.e("dsa", format.bitrate + "");
if (format.adaptive) {
menu.add(1, (i + 1), (i + 1), "Auto");
} else {
if (!formats.contains(format.bitrate)) {
menu.add(1, (i + 1), (i + 1), (format.bitrate) / 1000 + " kbps");
formats.add(format.bitrate);
}
}
}
}
menu.setGroupCheckable(1, true, true);
menu.findItem((player.getSelectedTrack(0) + 1)).setChecked(true);
popup.show();
}
代码示例来源:origin: fire3/sailorcast
private void configurePopupWithTracks(PopupMenu popup,
final OnMenuItemClickListener customActionClickListener,
final int trackType) {
if (player == null) {
return;
}
int trackCount = player.getTrackCount(trackType);
if (trackCount == 0) {
return;
}
popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return (customActionClickListener != null
&& customActionClickListener.onMenuItemClick(item))
|| onTrackItemClick(item, trackType);
}
});
Menu menu = popup.getMenu();
// ID_OFFSET ensures we avoid clashing with Menu.NONE (which equals 0).
menu.add(MENU_GROUP_TRACKS, DemoPlayer.TRACK_DISABLED + ID_OFFSET, Menu.NONE, R.string.off);
for (int i = 0; i < trackCount; i++) {
menu.add(MENU_GROUP_TRACKS, i + ID_OFFSET, Menu.NONE,
buildTrackName(player.getTrackFormat(trackType, i)));
}
menu.setGroupCheckable(MENU_GROUP_TRACKS, true, true);
menu.findItem(player.getSelectedTrack(trackType) + ID_OFFSET).setChecked(true);
}
代码示例来源:origin: com.actionbarsherlock/actionbarsherlock
menu.setGroupCheckable(nonActionItem.getGroupId(), true, true);
代码示例来源:origin: com.willowtreeapps/oak-demos
menu.setGroupCheckable(nonActionItem.getGroupId(), true, true);
内容来源于网络,如有侵权,请联系作者删除!