Android 应用程序中的音频控制
我正在开发一个 Android 应用程序,我需要制作一个 optionMenu
,其中包含一个选项来禁用/启用应用程序中的声音。
android 是否可以完全控制应用程序的音量? 有什么方法可以做到这一点吗? 我必须用代码来做到这一点吗?
谢谢
I am working in an android app and I need to make an optionMenu
with an option to disable/enable the sounds in the app.
Is it possible in android have full control over the volume of the app?
Is there any method that could do that?
Must I do this with code?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在此处找到有用的信息。根据该答案,这是不可能的。只是不要播放声音。
You can find useful information here. According to that answer, it's not possible. Just don't play the sounds.
通过使用 AudioManager,您可以获得当前音量级别和最大音量级别。单击按钮/选择选项时,您还可以控制音量级别。这是代码。希望这对您设置音量有所帮助。
设置音量
By using AudioManager you can get current volume level and max volume level. At the time of button click/ option select you can control the volume level also. Here is the code.I hope this will help you to set volume.
To Set Volume