- 播放声音 - MediaPlayer 播放器, 同时只能播放一个音乐. 可以播放大文件. 播放背景音乐. MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setDataSource("/mnt/sdcard/bgmusic.mp3"); mediaPlayer.prepare(); // 准备. mediaPlayer.start(); 或 MediaPlayer mediaPlayer = MediaPlayer.create(MainActivity.this, R.raw.music); mediaPlayer.start(); - SoundPool 声音池, 同时播放多个声音(混合音效). 只允许申请1M的内存空间. SoundPool sp = new SoundPool(1, AudioManager.STREAM_MUSIC, 0); shoot1id = sp.load("/mnt/sdcard/shoot1.ogg", 1); sp.play(shoot1id, 1f, 1f, 0, 0, 1.0f);