同时支持平板电脑和手机的问题 - 声音

时间:2011-11-08 15:43:43

标签: android mute

我在我的应用程序中再次在设置屏幕中提供静音选项,但是虽然这会使我的声音效果静音,但是在平板电脑上按下的任何可点击项目仍然会获得默认的单击声音。如何阻止系统点击发生?这是我当前的playSound方法,它不会播放我的音效已经设置了。

    try {
        streamVolume = mAudioManager
           .getStreamVolume(AudioManager.STREAM_MUSIC);
    streamVolume = streamVolume
    / mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    } catch (NullPointerException e) {
        Log.e(DEBUG_TAG, "Null pointer returned from audio manager");
    }
    Integer soundToPlay = mSoundPoolMap.get(sound);
    if (streamVolume != 0.0f && soundToPlay != null && !mMute) {
        mSoundPool.play(mSoundPoolMap.get(sound), 
            streamVolume, streamVolume,
            1, 0, 1.0f);
    } else {
        Log.e(DEBUG_TAG, sound.toString() + " not found in sound pool map");
    }

}

您还可以提供平板电脑声音处理的其他提示吗?我认为它略有不同。

1 个答案:

答案 0 :(得分:1)

View#setSoundEffectsEnabled看起来像一种方式,但需要繁忙的工作来构建一组所有适用的视图。

相关问题