Android Guides | Samples

Android.Views.ActionProvider Class

An ActionProvider defines rich menu interaction in a single component.

See Also: ActionProvider

Syntax

[Android.Runtime.Register("android/view/ActionProvider", DoNotGenerateAcw=true)]
public abstract class ActionProvider : Object

Remarks

An ActionProvider defines rich menu interaction in a single component. ActionProvider can generate action views for use in the action bar, dynamically populate submenus of a MenuItem, and handle default menu item invocations.

An ActionProvider can be optionally specified for a IMenuItem and will be responsible for creating the action view that appears in the ActionBar in place of a simple button in the bar. When the menu item is presented in a way that does not allow custom action views, (e.g. in an overflow menu,) the ActionProvider can perform a default action.

There are two ways to use an action provider:

  • Set the action provider on a IMenuItem directly by calling IMenuItem.SetActionProvider(ActionProvider).
  • Declare the action provider in an XML menu resource. For example:

    xml Example

       <item android:id="@+id/my_menu_item"
         android:title="Title"
         android:icon="@drawable/my_menu_item_icon"
         android:showAsAction="ifRoom"
         android:actionProviderClass="foo.bar.SomeActionProvider" />

See Also

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 14

The members of Android.Views.ActionProvider are listed below.

See Also: Object

Public Constructors

Creates a new instance.

Protected Constructors

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

Public Properties

[read-only]
HasSubMenuBoolean. Determines if this ActionProvider has a submenu associated with it.
[read-only]
IsVisibleBoolean. If ActionProvider.OverridesItemVisibility returns true, the return value of this method will help determine the visibility of the IMenuItem this ActionProvider is bound to.

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

abstract
OnCreateActionView() : View
Factory method called by the Android framework to create new action views.
OnCreateActionView(IMenuItem) : View
Factory method called by the Android framework to create new action views.
OnPerformDefaultAction() : Boolean
Performs an optional default action.
OnPrepareSubMenu(ISubMenu)
Called to prepare an associated submenu for the menu item backed by this ActionProvider.
OverridesItemVisibility() : Boolean
The result of this method determines whether or not ActionProvider.IsVisible will be used by the IMenuItem this ActionProvider is bound to help determine its visibility.
RefreshVisibility()
If this ActionProvider is associated with an item in a menu, refresh the visibility of the item based on ActionProvider.OverridesItemVisibility and ActionProvider.IsVisible.
SetVisibilityListener(ActionProvider+IVisibilityListener)
Set a listener to be notified when this ActionProvider's overridden visibility changes.

Public Events