播放raw目录下的音频
布局代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.day20181119.MainActivity" >
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="btnPlay"
android:src="@drawable/play" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="btnPause"
android:src="@drawable/pause" />
</LinearLayout>
在MainActivity.java中开启
public class MainActivity extends Activ