先展示一张效果图,下面贴出代码:
seekbar_style.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#e0ca92"
android:endColor="#faeaaf"/>
<corners android:radius="2dp"/>
</shape>
thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ffffff" />
<size android:width="25dp"
android:height="25dp"/>
</shape>
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/current_music"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#ffffff"
android:padding="10dip"
android:text="this is Textview..."
/>
<Gallery
android:id="@+id/gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:spacing="16dp"
>
</Gallery>
<SeekBar
android:id="@+id/seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/seekbar_style"
android:thumb="@drawable/thumb"
android:progress="5"
android:secondaryProgress="0"
android:max="100"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:00"
android:id="@+id/current_time_text"/>
<TextView
android:id="@+id/end_time_text"
android:text="00:00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/btStart"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/start"/>
<ImageButton
android:id="@+id/pause"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/pause"/>
<ImageButton
android:id="@+id/before"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/navigate_before"/>
<ImageButton
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/next"/>
<ImageButton
android:id="@+id/btStop"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/stop"/>
</LinearLayout>
</LinearLayout>