public interface

SupportMenu

 androidx.core.internal.view.SupportMenu

Subclasses:

SupportSubMenu, MenuBuilder, SubMenuBuilder

Gradle dependencies

compile group: 'androidx.core', name: 'core', version: '1.15.0-alpha02'

  • groupId: androidx.core
  • artifactId: core
  • version: 1.15.0-alpha02

Artifact androidx.core:core:1.15.0-alpha02 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.core:core com.android.support:support-compat

Androidx class mapping:

androidx.core.internal.view.SupportMenu android.support.v4.internal.view.SupportMenu

Overview

Interface for managing the items in a menu. This version extends the one available in the framework to ensures that any necessary elements added in later versions of the framework, are available for all platforms.

Summary

Fields
public static final intCATEGORY_MASK

This is the part of an order integer that supplies the category of the item.

public static final intCATEGORY_SHIFT

Bit shift of the category portion of the order integer.

public static final intFLAG_KEEP_OPEN_ON_SUBMENU_OPENED

Flag which stops the Menu being closed when a sub menu is opened

public static final intSUPPORTED_MODIFIERS_MASK

A mask of all supported modifiers for MenuItem's keyboard shortcuts

public static final intUSER_MASK

This is the part of an order integer that the user can provide.

public static final intUSER_SHIFT

Bit shift of the user portion of the order integer.

Methods
public voidsetGroupDividerEnabled(boolean enabled)

Enable or disable the group dividers.

Fields

public static final int USER_MASK

This is the part of an order integer that the user can provide.

public static final int USER_SHIFT

Bit shift of the user portion of the order integer.

public static final int CATEGORY_MASK

This is the part of an order integer that supplies the category of the item.

public static final int CATEGORY_SHIFT

Bit shift of the category portion of the order integer.

public static final int SUPPORTED_MODIFIERS_MASK

A mask of all supported modifiers for MenuItem's keyboard shortcuts

public static final int FLAG_KEEP_OPEN_ON_SUBMENU_OPENED

Flag which stops the Menu being closed when a sub menu is opened

Methods

public void setGroupDividerEnabled(boolean enabled)

Enable or disable the group dividers.

Parameters:

enabled: True if enabled.

Source

/*
 * Copyright (C) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.core.internal.view;

import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX;

import android.view.KeyEvent;

import androidx.annotation.RestrictTo;

/**
 * Interface for managing the items in a menu.
 *
 * This version extends the one available in the framework to ensures that any necessary
 * elements added in later versions of the framework, are available for all platforms.
 *
 * @see android.view.Menu
 */
@RestrictTo(LIBRARY_GROUP_PREFIX)
public interface SupportMenu extends android.view.Menu {

    /**
     * This is the part of an order integer that the user can provide.
     */
    int USER_MASK = 0x0000ffff;

    /**
     * Bit shift of the user portion of the order integer.
     */
    int USER_SHIFT = 0;

    /**
     * This is the part of an order integer that supplies the category of the item.
     */
    int CATEGORY_MASK = 0xffff0000;

    /**
     * Bit shift of the category portion of the order integer.
     */
    int CATEGORY_SHIFT = 16;

    /**
     * A mask of all supported modifiers for MenuItem's keyboard shortcuts
     */
    int SUPPORTED_MODIFIERS_MASK = KeyEvent.META_META_ON | KeyEvent.META_CTRL_ON
            | KeyEvent.META_ALT_ON | KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON
            | KeyEvent.META_FUNCTION_ON;

    /**
     * Flag which stops the Menu being closed when a sub menu is opened
     */
    int FLAG_KEEP_OPEN_ON_SUBMENU_OPENED = 4;

    /**
     * Enable or disable the group dividers.
     *
     * @param enabled True if enabled.
     */
    @Override
    void setGroupDividerEnabled(boolean enabled);
}