当前位置: 首页>>代码示例>>Java>>正文


Java NavigationMenu类代码示例

本文整理汇总了Java中android.support.design.internal.NavigationMenu的典型用法代码示例。如果您正苦于以下问题:Java NavigationMenu类的具体用法?Java NavigationMenu怎么用?Java NavigationMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NavigationMenu类属于android.support.design.internal包,在下文中一共展示了NavigationMenu类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.design.internal.NavigationMenu; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu_items_sample);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final EditText inputView = (EditText) findViewById(R.id.puppy_name);

    FabSpeedDial fabSpeedDial = ((FabSpeedDial) findViewById(R.id.fab_speed_dial));
    fabSpeedDial.setMenuListener(new SimpleMenuListenerAdapter() {
        @Override
        public boolean onPrepareMenu(NavigationMenu navigationMenu) {
            String input = inputView.getText().toString();

            if (TextUtils.isEmpty(input)) {
                Snackbar.make(findViewById(R.id.rootView), "Enter the name of your puppy",
                        Snackbar.LENGTH_SHORT).show();
                return false;
            }

            setMenuItemTitle(navigationMenu, R.id.action_call, input);
            setMenuItemTitle(navigationMenu, R.id.action_text, input);
            setMenuItemTitle(navigationMenu, R.id.action_email, input);

            setMenuItemVisibility(navigationMenu, R.id.action_call, R.id.menu_item_call_switch);
            setMenuItemVisibility(navigationMenu, R.id.action_text, R.id.menu_item_text_switch);
            setMenuItemVisibility(navigationMenu, R.id.action_email, R.id.menu_item_email_switch);

            return true;
        }
    });

}
 
开发者ID:yavski,项目名称:fab-speed-dial,代码行数:35,代码来源:MenuItemsSampleActivity.java

示例2: onPrepareMenu

import android.support.design.internal.NavigationMenu; //导入依赖的package包/类
@Override
public boolean onPrepareMenu(NavigationMenu navigationMenu) {

    return true;
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:6,代码来源:SimpleMenuListenerAdapter.java

示例3: setMenuItemTitle

import android.support.design.internal.NavigationMenu; //导入依赖的package包/类
private void setMenuItemTitle(NavigationMenu menu, int menuItemId, CharSequence input) {
    MenuItem menuItem = menu.findItem(menuItemId);
    String oldMenuItemTitle = menuItem.getTitle().toString();
    menuItem.setTitle(oldMenuItemTitle + " " + input);
}
 
开发者ID:yavski,项目名称:fab-speed-dial,代码行数:6,代码来源:MenuItemsSampleActivity.java

示例4: setMenuItemVisibility

import android.support.design.internal.NavigationMenu; //导入依赖的package包/类
private void setMenuItemVisibility(NavigationMenu menu, int menuItemId, int switchItem) {
    SwitchCompat switchView = (SwitchCompat) findViewById(switchItem);
    menu.findItem(menuItemId).setVisible(switchView.isChecked());
}
 
开发者ID:yavski,项目名称:fab-speed-dial,代码行数:5,代码来源:MenuItemsSampleActivity.java

示例5: onPrepareMenu

import android.support.design.internal.NavigationMenu; //导入依赖的package包/类
/**
 * Called just before the menu items are about to become visible.
 * Don't block as it's called on the main thread.
 *
 * @param navigationMenu The menu containing all menu items.
 * @return You must return true for the menu to be displayed;
 * if you return false it will not be shown.
 */
boolean onPrepareMenu(NavigationMenu navigationMenu);
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:10,代码来源:FabSpeedDial.java


注:本文中的android.support.design.internal.NavigationMenu类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。