本文整理匯總了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);
}
}
}