Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的应用程序中,我有静音按钮,并且 onClick 事件中有一些代码:
AudioManager am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE); am.setStreamMute(AudioManager.STREAM_MUSIC, true);
我希望,只会使我的应用程序静音,但它会使系统静音。我该如何解决?谢谢大家。
试试这个
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);