如何创建自定义用户界面为Android的MediaController [英] how to create custom UI for android MediaController

查看:1451
本文介绍了如何创建自定义用户界面为Android的MediaController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义的的MediaController的控制我的视频播放器。 我想换出图像的播放按钮,改变皮肤,改变颜色,等。

I want to customize the controls in the MediaController for my video player. I want to swap out the image for the play button, change the skin, change the color, ect.

是否有这样做的一个已知的方法是什么?

Is there a known way of doing this?

感谢

推荐答案

我对最近的一个项目同样的问题,并最终创建基于关股票的MediaController自定义实现。它增加了一个全屏按钮在最右边,但即便这不是你想要的这个类应该是一个很好的起点。

I had the same problem on a recent project and ended up creating a custom implementation based off the stock MediaController. It adds a fullscreen button at the far right, but even if that's not what you want this class should be a good starting point.

code:

  • VideoControllerView.java - http://pastebin.com/1V63aVSg
  • media_controller.xml - http://pastebin.com/rS4xqMej

图片资源:

技巧:

  • 类假定锚观点是的FrameLayout底部将自己定位。
  • 类不使用窗口,以确保在锚上方的调节浮动。然而,这不是一个问题,我作为show()方法确实mAnchor.addView()每次。
  • 类使用它自己的MediaPlayerControl协议。这使得自定义设置,如toggleFullScreen()

修改:请参见本教程的详细信息:的 http://www.brightec.co.uk/blog/custom-android-media-controller

EDIT: See this tutorial for more details: http://www.brightec.co.uk/blog/custom-android-media-controller

这篇关于如何创建自定义用户界面为Android的MediaController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆