Android Guides | Samples

Android.Widget.MediaController Class

A view containing controls for a MediaPlayer.

See Also: MediaController

Syntax

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

Remarks

A view containing controls for a MediaPlayer. Typically contains the buttons like "Play/Pause", "Rewind", "Fast Forward" and a progress slider. It takes care of synchronizing the controls with the state of the MediaPlayer.

The way to use this class is to instantiate it programmatically. The MediaController will create a default set of controls and put them in a window floating above your application. Specifically, the controls will float above the view specified with setAnchorView(). The window will disappear if left idle for three seconds and reappear when the user touches the anchor view.

Functions like show() and hide() have no effect when MediaController is created in an xml layout. MediaController will hide and show the buttons according to these rules:

  • The "previous" and "next" buttons are hidden until setPrevNextListeners() has been called
  • The "previous" and "next" buttons are visible but disabled if setPrevNextListeners() was called with null listeners
  • The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false

[Android Documentation]

Requirements

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

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

See Also: FrameLayout

Public Constructors

Protected Constructors

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

Public Properties

[read-only]
IsShowingBoolean.

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

Hide()
Remove the controller from the screen.
OnFinishInflate()
Finalize inflating a view from XML.
SetAnchorView(View)
Set the view that acts as the anchor for the control view.
SetMediaPlayer(MediaController+IMediaPlayerControl)
SetPrevNextListeners(View+IOnClickListener, View+IOnClickListener)
Show()
Show the controller on screen.
Show(Int32)
Show the controller on screen.

Public Events