Android Guides | Samples

Android.Widget.Toolbar Class

A standard toolbar for use within application content.

See Also: Toolbar

Syntax

[Android.Runtime.Register("android/widget/Toolbar", DoNotGenerateAcw=true)]
public class Toolbar : ViewGroup

Remarks

A standard toolbar for use within application content.

A Toolbar is a generalization of ActionBar for use within application layouts. While an action bar is traditionally part of an Activity opaque window decor controlled by the framework, a Toolbar may be placed at any arbitrary level of nesting within a view hierarchy. An application may choose to designate a Toolbar as the action bar for an Activity using the Activity.SetActionBar(Toolbar) method.

Toolbar supports a more focused feature set than ActionBar. From start to end, a toolbar may contain a combination of the following optional elements:

In modern Android UIs developers should lean more on a visually distinct color scheme for toolbars than on their application icon. The use of application icon plus title as a standard layout is discouraged on API 21 devices and newer.

[Android Documentation]

Requirements

Namespace: Android.Widget
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.Widget.Toolbar are listed below.

See Also: ViewGroup

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
ContentInsetEndInt32. Get the ending content inset for this toolbar.
[read-only]
ContentInsetLeftInt32. Get the left content inset for this toolbar.
[read-only]
ContentInsetRightInt32. Get the right content inset for this toolbar.
[read-only]
ContentInsetStartInt32. Get the starting content inset for this toolbar.
[read-only]
HasExpandedActionViewBoolean. Check whether this Toolbar is currently hosting an expanded action view.
[read-only]
IsOverflowMenuShowingBoolean. Check whether the overflow menu is currently showing.
LogoDrawable. Return the current logo drawable.
LogoDescriptionString.
LogoDescriptionFormattedICharSequence. Return the description of the toolbar's logo.
[read-only]
MenuIMenu. Return the Menu shown in the toolbar.
NavigationContentDescriptionString.
NavigationContentDescriptionFormattedICharSequence. Retrieve the currently configured content description for the navigation button view.
NavigationIconDrawable. Return the current drawable used as the navigation icon.
PopupThemeInt32.
SubtitleString.
SubtitleFormattedICharSequence. Return the subtitle of this toolbar.
TitleString.
TitleFormattedICharSequence. Returns the title of this toolbar.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

CollapseActionView()
Collapse a currently expanded action view.
DismissPopupMenus()
Dismiss all currently showing popup menus, including overflow or submenus.
HideOverflowMenu() : Boolean
Hide the overflow items from the associated menu.
InflateMenu(Int32)
Inflate a menu resource into this toolbar.
SetContentInsetsAbsolute(Int32, Int32)
Set the content insets for this toolbar.
SetContentInsetsRelative(Int32, Int32)
Set the content insets for this toolbar relative to layout direction.
SetLogo(Int32)
Set a logo drawable from a resource id.
SetLogoDescription(Int32)
Set a description of the toolbar's logo.
SetNavigationContentDescription(Int32)
Set a content description for the navigation button if one is present.
SetNavigationIcon(Int32)
Set the icon to use for the toolbar's navigation button.
SetNavigationOnClickListener(View+IOnClickListener)
Set a listener to respond to navigation events.
SetOnMenuItemClickListener(Toolbar+IOnMenuItemClickListener)
Set a listener to respond to menu item click events.
SetSubtitle(Int32)
Set the subtitle of this toolbar.
SetSubtitleTextAppearance(Context, Int32)
Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.
SetSubtitleTextColor(Color)
Sets the text color of the subtitle, if present.
SetTitle(Int32)
Set the title of this toolbar.
SetTitleTextAppearance(Context, Int32)
Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.
SetTitleTextColor(Color)
Sets the text color of the title, if present.
ShowOverflowMenu() : Boolean
Show the overflow items from the associated menu.

Protected Methods

override
OnLayout(Boolean, Int32, Int32, Int32, Int32)
Called from layout when this view should assign a size and position to each of its children.

Public Events