AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
// 设置声音类型
int streamType = AudioManager.STREAM_MUSIC;
// 设置音量(音乐音量最大值的一半)
int index = audioManager
.getStreamMaxVolume(AudioManager.STREAM_MUSIC) / 2;
// 标记
int flags = AudioManager.FLAG_PLAY_SOUND;
// 直接设置媒体音大小
audioManager.setStreamVolume(streamType, index, flags);
直接设置媒体音量大小
最新推荐文章于 2021-08-02 20:06:31 发布