Android 媒体音量控制器(无论它叫什么)的自定义主题?
我正在尝试自定义媒体音量控制器的主题(我不知道它叫什么,只是尝试命名它)。它类似于一个标题为“媒体音量”的 Toast,当我们在游戏中按下音量按钮(+ 和 -)时,就会出现该标题。但我不知道它是哪个View,或者它是一个Toast、一个Dialog。就我所尝试的而言,我找不到任何提及它的内容。仅Activity.setVolumeControlStream(AudioManager.STREAM_MUSIC) 在您的活动中启用它,仅此而已。如果有人知道如何自定义它,或者只是它的名称,请帮助我! 谢谢。
I'm trying custom the theme of Media Volume Controller (I don't know what it's called, just try to name it). It's something like a Toast with "Media Volume" title which appears when we press volume buttons (+ and -) in games. But I don't know which View it's, or it's a Toast, a Dialog. So far as I try, I could not find anything which refers it. Only Activity.setVolumeControlStream(AudioManager.STREAM_MUSIC)
to enable it in your Activity, and nothing more. If someone know how to custom it, or just it's name, please help me!
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
抱歉我对你的问题的误解。
我认为您可以自定义“媒体音量控制器”的方法是自己控制音量并显示您的自定义视图(或Toast)。因为“Media Volume”Toast(它是一个Toast,参见VolumePanel.onShowVolumeChanged )由 Android 系统创建并显示,您无法自定义。
这是可能解决您的问题的示例代码:
Sorry for my misunderstanding of your question.
I think the way you can customize "Media Volume Controller" is control volume yourself and show your customize view(or Toast). Because the "Media Volume" Toast(It is a Toast, see the source code of VolumePanel.onShowVolumeChanged ) is created and shown by android system which you cannot customize.
Here is the sample code which might solve your problem:
您可以覆盖游戏 Activity 的
onKeyDown
。并根据刚刚按下的键显示“Toast”。当在 Activity 中按下某个键时,将调用onKeyDown
方法。以下是示例代码:You can override the
onKeyDown
of your game Activity. And show the "Toast" according to the key just pressed.onKeyDown
method will be called when a key was pressed down in your Activity. Following is sample code: