本文整理匯總了Java中android.support.v7.view.menu.MenuBuilder.Callback方法的典型用法代碼示例。如果您正苦於以下問題:Java MenuBuilder.Callback方法的具體用法?Java MenuBuilder.Callback怎麽用?Java MenuBuilder.Callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.view.menu.MenuBuilder
的用法示例。
在下文中一共展示了MenuBuilder.Callback方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setMenuCallbacks
import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
public void setMenuCallbacks(Callback pcb, MenuBuilder.Callback mcb) {
this.mActionMenuPresenterCallback = pcb;
this.mMenuBuilderCallback = mcb;
if (this.mMenuView != null) {
this.mMenuView.setMenuCallbacks(pcb, mcb);
}
}
示例2: setMenuCallbacks
import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
public void setMenuCallbacks(Callback pcb, MenuBuilder.Callback mcb) {
this.mActionMenuPresenterCallback = pcb;
this.mMenuBuilderCallback = mcb;
}
示例3: setMenuCallbacks
import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
public void setMenuCallbacks(MenuPresenter.Callback actionMenuPresenterCallback, MenuBuilder.Callback menuBuilderCallback) {
this.mToolbar.setMenuCallbacks(actionMenuPresenterCallback, menuBuilderCallback);
}
示例4: setToolbarContentColor
import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static void setToolbarContentColor(@NonNull Context context, Toolbar toolbar, @Nullable Menu menu, final @ColorInt int toolbarContentColor, final @ColorInt int titleTextColor, final @ColorInt int subtitleTextColor, final @ColorInt int menuWidgetColor) {
if (toolbar == null) return;
if (menu == null) {
menu = toolbar.getMenu();
}
toolbar.setTitleTextColor(titleTextColor);
toolbar.setSubtitleTextColor(subtitleTextColor);
if (toolbar.getNavigationIcon() != null) {
// Tint the toolbar navigation icon (e.g. back, drawer, etc.)
toolbar.setNavigationIcon(TintHelper.createTintedDrawable(toolbar.getNavigationIcon(), toolbarContentColor));
}
InternalToolbarContentTintUtil.tintMenu(toolbar, menu, toolbarContentColor);
InternalToolbarContentTintUtil.applyOverflowMenuTint(context, toolbar, menuWidgetColor);
if (context instanceof Activity) {
InternalToolbarContentTintUtil.setOverflowButtonColor((Activity) context, toolbarContentColor);
}
try {
// Tint immediate overflow menu items
final Field menuField = Toolbar.class.getDeclaredField("mMenuBuilderCallback");
menuField.setAccessible(true);
final Field presenterField = Toolbar.class.getDeclaredField("mActionMenuPresenterCallback");
presenterField.setAccessible(true);
final Field menuViewField = Toolbar.class.getDeclaredField("mMenuView");
menuViewField.setAccessible(true);
final MenuPresenter.Callback currentPresenterCb = (MenuPresenter.Callback) presenterField.get(toolbar);
if (!(currentPresenterCb instanceof ATHMenuPresenterCallback)) {
final ATHMenuPresenterCallback newPresenterCb = new ATHMenuPresenterCallback(context, menuWidgetColor, currentPresenterCb, toolbar);
final MenuBuilder.Callback currentMenuCb = (MenuBuilder.Callback) menuField.get(toolbar);
toolbar.setMenuCallbacks(newPresenterCb, currentMenuCb);
ActionMenuView menuView = (ActionMenuView) menuViewField.get(toolbar);
if (menuView != null)
menuView.setMenuCallbacks(newPresenterCb, currentMenuCb);
}
// OnMenuItemClickListener to tint submenu items
final Field menuItemClickListener = Toolbar.class.getDeclaredField("mOnMenuItemClickListener");
menuItemClickListener.setAccessible(true);
Toolbar.OnMenuItemClickListener currentClickListener = (Toolbar.OnMenuItemClickListener) menuItemClickListener.get(toolbar);
if (!(currentClickListener instanceof ATHOnMenuItemClickListener)) {
final ATHOnMenuItemClickListener newClickListener = new ATHOnMenuItemClickListener(context, menuWidgetColor, currentClickListener, toolbar);
toolbar.setOnMenuItemClickListener(newClickListener);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: setMenuCallback
import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
/**
* Set the callback that will be called when menu
* items a selected.
*/
public void setMenuCallback(final MenuBuilder.Callback menuCallback) {
this.mMenuCallback = menuCallback;
}
示例6: setMenuCallback
import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
/**
* Set the callback that will be called when menu
* items a selected.
*
* @param menuCallback
*/
public void setMenuCallback(MenuBuilder.Callback menuCallback) {
this.mMenuCallback = menuCallback;
}
示例7: setMenuCallbacks
import android.support.v7.view.menu.MenuBuilder; //導入方法依賴的package包/類
void setMenuCallbacks(Callback callback, MenuBuilder.Callback callback2);