SeekBar

main.xml

<?xmlversion="1.0"encoding="utf-8"?>

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"android:layout_width="fill_parent"

android:layout_height="fill_parent">

<TextViewandroid:layout_width="fill_parent"

android:layout_height="wrap_content"android:text="@string/hello"/>

<SeekBarandroid:id="@android:id/progress"style="?android:attr/progressBarStyleHorizontal"

android:progressDrawable="@drawable/seekbar_style"android:thumb="@drawable/seek"

android:layout_width="fill_parent"android:layout_height="23dip"

android:paddingLeft="25dip"android:paddingRight="25dip"

android:paddingBottom="4dip"/>

</LinearLayout>

styles

<?xmlversion="1.0"encoding="UTF-8"?>

<layer-listxmlns:android="http://schemas.android.com/apk/res/android">

<itemandroid:id="@android:id/background">

<shape>

<cornersandroid:radius="10dip"/>

<gradientandroid:startColor="#ffffffff"

android:centerColor="#ff000000"android:endColor="#ff808A87"

android:centerY="0.45"android:angle="270"/>

</shape>

</item>

<itemandroid:id="@android:id/progress">

<clip>

<shape>

<cornersandroid:radius="10dip"/>

<gradientandroid:startColor="#ffffffff"

android:centerColor="#ffFFFF00"android:endColor="#ffAABD00"

android:centerY="0.45"android:angle="270"/>

</shape>

</clip>

</item>

</layer-list>

seek.xml

<?xmlversion="1.0"encoding="UTF-8"?>

<selectorxmlns:android="http://schemas.android.com/apk/res/android">

<!--按钮按下状态-->

<itemandroid:state_pressed="true"android:drawable="@drawable/seek"/>

<!--普通无焦点状态-->

<itemandroid:state_focused="false"android:state_pressed="false"

android:drawable="@drawable/seek"/>

</selector>

相关推荐