本文整理汇总了Java中android.view.MenuItem.isCheckable方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.isCheckable方法的具体用法?Java MenuItem.isCheckable怎么用?Java MenuItem.isCheckable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.isCheckable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.isCheckable()) {
item.setChecked(!item.isChecked());
if (item.getItemId() == MENU_ENABLE_REDIRECTS) {
enableRedirects = item.isChecked();
} else if (item.getItemId() == MENU_ENABLE_RELATIVE_REDIRECTs) {
enableRelativeRedirects = item.isChecked();
} else if (item.getItemId() == MENU_ENABLE_CIRCULAR_REDIRECTS) {
enableCircularRedirects = item.isChecked();
}
}
return super.onOptionsItemSelected(item);
}
示例2: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
int id = item.getItemId();
switch(id)
{
case R.id.menuFree:
feedUrl = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/limit=%d/xml";
break;
case R.id.MenuPaid:
feedUrl = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppaidapplications/limit=%d/xml";
break;
case R.id.menuSongs:
feedUrl = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=%d/xml";
break;
case R.id.menuTop10:
case R.id.menuTop25:
if(!item.isCheckable())
{
item.setChecked(true);
feedLimit = 35 - feedLimit;
}
break;
case R.id.menuRef:
feedCachedUrl = "NA";
break;
default:
return super.onOptionsItemSelected(item);
}
downloadUrl(String.format(feedUrl, feedLimit));
return true;
}
示例3: setExclusiveItemChecked
import android.view.MenuItem; //导入方法依赖的package包/类
void setExclusiveItemChecked(MenuItem item) {
int group = item.getGroupId();
int N = this.mItems.size();
for (int i = 0; i < N; i++) {
MenuItem curItem = (MenuItemImpl) this.mItems.get(i);
if (curItem.getGroupId() == group && curItem.isExclusiveCheckable() && curItem.isCheckable()) {
curItem.setCheckedInt(curItem == item);
}
}
}