material-popup-menu / com.github.zawadz88.materialpopupmenu / MaterialPopupMenuBuilder

MaterialPopupMenuBuilder

class MaterialPopupMenuBuilder

Builder for creating a MaterialPopupMenu.

The MaterialPopupMenu must have at least one section. All sections must also have at least one item and each item must have a non-null label set.

Author
Piotr Zawadzki

Types

AbstractItemHolder

abstract class AbstractItemHolder

CustomItemHolder

class CustomItemHolder : MaterialPopupMenuBuilder.AbstractItemHolder

Holds section custom item info for the builder. This gets converted to MaterialPopupMenu.PopupMenuCustomItem.

ItemHolder

class ItemHolder : MaterialPopupMenuBuilder.AbstractItemHolder

Holds section item info for the builder. This gets converted to MaterialPopupMenu.PopupMenuItem.

SectionHolder

class SectionHolder

Holds section info for the builder. This gets converted to MaterialPopupMenu.PopupMenuSection.

Constructors

<init>

MaterialPopupMenuBuilder()

Builder for creating a MaterialPopupMenu.

Properties

dropdownGravity

var dropdownGravity: Int

Gravity of the dropdown list. This is commonly used to set gravity to START or END for alignment with the anchor. Setting Gravity.BOTTOM will anchor the dropdown list below the view.

dropDownHorizontalOffset

var dropDownHorizontalOffset: Int?

Setting this to non-null value will override android:dropDownHorizontalOffset set by the style applied in style.

dropDownVerticalOffset

var dropDownVerticalOffset: Int?

Setting this to non-null value will override android:dropDownVerticalOffset set by the style applied in style.

fixedContentWidthInPx

var fixedContentWidthInPx: Int

Setting this to a non-zero value will force the width of the popup menu to be exactly this value. If set to 0, the default mechanism for measuring popup menu width will be applied.

style

var style: Int

Style of the popup menu.

Functions

build

fun build(): MaterialPopupMenu

Creates a MaterialPopupMenu with the already configured params.

section

fun section(init: MaterialPopupMenuBuilder.SectionHolder.() -> Unit): Unit

Adds a new section to the popup menu.