本文整理汇总了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;
}