静音只正在运行的应用的声音在android系统 [英] Mute only the running apps sound in android

查看:324
本文介绍了静音只正在运行的应用的声音在android系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序,其中有一些言论给用户。还有一个静音按钮。我可以静音我的应用程序的声音独自一人,不影响音乐播放器的声音,如果它是在回地面??


解决方案

  MediaPlayer的MP = MediaPlayer.create(背景下,R.raw.sound_file_1);
 mp.start();

有关静音

  mp.setvolume(0,0);

&安培;取消静音或完整卷

  mp.setvolume(0,1);

I am developing an android application in which there is some speech to the user. there is also a mute button. Can i mute the sound of my application alone, not affecting the sound of music player if it is playing in the back ground??

解决方案

MediaPlayer mp = MediaPlayer.create(context, R.raw.sound_file_1);
 mp.start();

for Mute

mp.setvolume(0,0);

& Unmute or full volume

mp.setvolume(0,1);

这篇关于静音只正在运行的应用的声音在android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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