本文整理匯總了Java中android.view.MenuItem.setTitleCondensed方法的典型用法代碼示例。如果您正苦於以下問題:Java MenuItem.setTitleCondensed方法的具體用法?Java MenuItem.setTitleCondensed怎麽用?Java MenuItem.setTitleCondensed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.setTitleCondensed方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateBookmarkMenuItem
import android.view.MenuItem; //導入方法依賴的package包/類
/**
* Updates the bookmark item's visibility.
*
* @param bookmarkMenuItem {@link MenuItem} for adding/editing the bookmark.
* @param currentTab Current tab being displayed.
*/
protected void updateBookmarkMenuItem(MenuItem bookmarkMenuItem, Tab currentTab) {
bookmarkMenuItem.setEnabled(mBookmarkBridge.isEditBookmarksEnabled());
if (currentTab.getBookmarkId() != Tab.INVALID_BOOKMARK_ID) {
bookmarkMenuItem.setIcon(R.drawable.btn_star_filled);
bookmarkMenuItem.setChecked(true);
bookmarkMenuItem.setTitleCondensed(mActivity.getString(R.string.edit_bookmark));
} else {
bookmarkMenuItem.setIcon(R.drawable.btn_star);
bookmarkMenuItem.setChecked(false);
bookmarkMenuItem.setTitleCondensed(null);
}
}
示例2: onOptionsItemSelected
import android.view.MenuItem; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case R.id.Filter:
if (item.getTitleCondensed().equals("Filter")) {
seismo_view_.filter();
item.setTitle("Unfilter noise");
item.setTitleCondensed("Unfilter");
} else {
seismo_view_.unfilter();
item.setTitle("Filter noise");
item.setTitleCondensed("Filter");
}
return true;
case R.id.Pause:
if (item.getTitleCondensed().equals("Pause")) {
seismo_view_.pause();
item.setTitle("Resume measurement");
item.setTitleCondensed("Resume");
} else {
seismo_view_.resume();
item.setTitle("Pause measurement");
item.setTitleCondensed("Pause");
}
return true;
case R.id.x:
seismo_view_.x();
return true;
case R.id.y:
seismo_view_.y();
return true;
case R.id.z:
seismo_view_.z();
return true;
case R.id.Save:
seismo_view_.save();
return true;
case R.id.Export:
startActivity(new Intent(this, Export.class));
return true;
case R.id.Help:
startActivity(new Intent(this, Help.class));
return true;
}
return false;
}