开发者

Android MediaController Next Previous Buttons

开发者 https://www.devze.com 2023-03-15 08:04 出处:网络
So, For Android\'s MediaController I found this \"The \"previous\" and \"next\" buttons are hidden unt开发者_如何学编程il setPrevNextListeners() has been called.\"I\'d like to show the next and previo

So, For Android's MediaController I found this "The "previous" and "next" buttons are hidden unt开发者_如何学编程il setPrevNextListeners() has been called." I'd like to show the next and previous. Can someone help me understand how to set this up?

Thanks


Assuming you are using a VideoView control withing an activity, (let's call it videoView), you will want to attach a MediaController to it. Try the following:

MediaController mc = new MediaController(this);
mc.setPrevNextListeners(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
    //Handle next click here
  }
}, new View.OnClickListener() {
  @Override
  public void onClick(View v) {
    //Handle previous click here
  }
});
videoView.setMediaController(mc);

This should do the trick.

0

精彩评论

暂无评论...
验证码 换一张
取 消