Android7.0中文文档(API) --- MediaController

完整内容,请查看: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。

摘要


嵌套类

interfaceMediaController.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方法

booleandispatchKeyEvent(KeyEvent event)

Dispatch a key event to the next view on the focus path.
向焦点路径上的下一个视图派发一个KeyEvent。

CharSequencegetAccessibilityClassName()

Return the class name of this object to be used for accessibility purposes.
返回此对象的类名,用于辅助功能目的。

voidhide()

Remove the controller from the screen.
从屏幕上移除控件。

booleanisShowing()
voidonFinishInflate()

Finalize inflating a view from XML.
完成从XML中加载(inflate)的视图。

booleanonTouchEvent(MotionEvent event)

Implement this method to handle touch screen motion events.
实现此方法,以处理触摸屏的MotionEvent。

booleanonTrackballEvent(MotionEvent ev)

Implement this method to handle trackball motion events.
实现此方法,以处理滚迹球的MotionEvent。

voidsetAnchorView(View view)

Set the view that acts as the anchor for the control view.
设置控件视图所属的视图。

voidsetEnabled(boolean enabled)

Set the enabled state of this view.
设置此视图的使能状态。

voidsetMediaPlayer(MediaController.MediaPlayerControl player)
voidsetPrevNextListeners(View.OnClickListener next, View.OnClickListener prev)
voidshow(int timeout)

Show the controller on screen.
在屏幕上显示控件。

voidshow()

Show the controller on screen.
在屏幕上显示控件。

继承方法

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/MediaController.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值