如何控制媒体的音量? [英] How to control media volume?

查看:143
本文介绍了如何控制媒体的音量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想控制媒体音量,使用常规的音量按钮我的应用程序。 问题是我的应用程序是使用短的声音,他们可能是恼人的用户。你只可以,而他们玩(1秒)调整介质卷,然后它开始调整铃声音量。 我怎样才能让媒体音量默认?

I would like to control media volume with my app using regular volume buttons. The problem is my app is using short sounds, and they might be annoying for the user. You can only adjust media volume while they are playing (for 1 sec) then it starts to adjust ringer volume. How can I make media volume default?

推荐答案

在您的活动的onCreate(),你可以这样做:

In your activity's onCreate() you can do:

setVolumeControlStream(AudioManager.STREAM_MUSIC);

这篇关于如何控制媒体的音量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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