1,创建应用界面
2,设置界面布局资源(activity_main.xml)
<?xml version="1.0" encoding="utf-8"?>
<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"
android:orientation="vertical"
android:padding="20dp"
android:background="@drawable/backgroud"
tools:context=".ui.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/pbScanMusic"
android:layout_width="100dp"
android:layout_height="100dp"
android:visibility="gone"/>
<TextView
android:id="@+id/tvScanMusic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/scan_music"
android:textColor="#0000ff"
android:textSize="25sp"
android:visibility="gone"/>
</LinearLayout>
<ListView
android:id="@+id/lvMusicName"
android:layout_width="match_parent"
android:layout_height="450dp"
android:layout_marginBottom="16dp"
android:layout_weight="8" />
<TextView
android:id="@+id/tvMusicName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_weight="0.5"
android:textColor="#0000ff"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_weight="0.5"
android:gravity="center">
<TextView
android:id="@+id/tvCurrentPosition"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#ff0000"/>
<ProgressBar
android:id="@+id/pbMusicProgress"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:layout_weight="6"/>
<TextView
android:id="@+id/tvDuration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#ff00ff"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="center">
<Button
android:id="@+id/btnPrevious"
android:layout_width="60dp"
android:layout_height="50dp"
android:background="@drawable/previous_button_selector"
android:onClick="doPrevious"/>
<Button
android:id="@+id/btnPlayOrPause"
android:layout_width="60dp"
android:layout_height="50dp"
android:background