完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/MediaController.html
MediaController
public class MediaController
extends FrameLayout
java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | android.widget.MediaController |
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.
控制MediaPlayer的视图。通常包含“播放/暂停”、“后退”、“快进”和一个进度条。它负责将控件与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.
使用这个类的方法是以编程的方式实例化它。MediaController将创建一个默认的一组控件,并将它们放在应用程序上的一个窗口中。具体来说,控件将放置在setAnchorView()指定的视图上。如果被闲置三秒钟,窗口将消失,当用户触摸这个所属的视图时,则将重新出现。
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
当MediaController是在XML布局中创建的,则像show()和hide()方法将不起作用。MediaController根据这些规则隐藏和显示按钮:
- 在setPrevNextListeners()被调用之前,“上一个”和“下一个”按钮被隐藏。
- 如果setPrevNextListeners()的调用设置了null的监听器,则“上一个”和“下一个”按钮将可见,但是是禁用的。
- “后退”和“快进”按钮将被显示出来,除非请求调用MediaController(Context, boolean)构造方法的boolean参数被设置为false。
摘要
嵌套类 | |
---|---|
interface | MediaController.MediaPlayerControl
|
继承XML属性 | |
---|---|
From class android.widget.FrameLayout
| |
From class android.view.ViewGroup
| |
From class android.view.View
|
继承常量 |
---|
From class android.view.ViewGroup
|
From class android.view.View
|
继承字段 |
---|
From class android.view.View
|
Public构造方法 | |
---|---|
MediaController(Context context, AttributeSet attrs) | |
MediaController(Context context, boolean useFastForward) | |
MediaController(Context context) |
Public方法 | |
---|---|
boolean | dispatchKeyEvent(KeyEvent event) Dispatch a key event to the next view on the focus path. |
CharSequence | getAccessibilityClassName() Return the class name of this object to be used for accessibility purposes. |
void | hide() Remove the controller from the screen. |
boolean | isShowing() |
void | onFinishInflate() Finalize inflating a view from XML. |
boolean | onTouchEvent(MotionEvent event) Implement this method to handle touch screen motion events. |
boolean | onTrackballEvent(MotionEvent ev) Implement this method to handle trackball motion events. |
void | setAnchorView(View view) Set the view that acts as the anchor for the control view. |
void | setEnabled(boolean enabled) Set the enabled state of this view. |
void | setMediaPlayer(MediaController.MediaPlayerControl player) |
void | setPrevNextListeners(View.OnClickListener next, View.OnClickListener prev) |
void | show(int timeout) Show the controller on screen. |
void | show() Show the controller on screen. |
继承方法
完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/MediaController.html