android声音播放
android播放声音,一种是soundPool,一种是mediaplayer soundpool 适合播放反映速度要求较高的声效,比如,游戏中的爆炸音效 mediaplay 适合播放时间比较长的声效,比如,游戏中的背景音乐 我们来做个例子,一个是chang.ogg,一个是duan.wav 这两个声效文件,我是从我的游戏目录中的笑傲江湖OL中搜索出来的。你也可以到你的游戏文件夹下搜索 *.ogg,*.wav 将这两个文件放到res/raw目录下,如果不存在raw目录,请创建它 定义activity_main.xml,里边放一个TextView和4个Button <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin"