首页 > 其他 > 详细

Andorid 自定义seekbar

时间:2016-11-06 02:19:03      阅读:228      评论:0      收藏:0      [点我收藏+]

  效果如图:

技术分享

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <style name="Widget.SeekBar.Normal" parent="@android:style/Widget.SeekBar">
        <item name="android:maxHeight">8.0dip</item>
        <item name="android:indeterminateOnly">false</item>
        <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item>
        <item name="android:progressDrawable">@drawable/seekbar_horizontal</item>
        <item name="android:minHeight">8.0dip</item>
        <item name="android:thumb">@drawable/seek_thumb</item>
        <item name="android:thumbOffset">10.0dip</item>
    </style>    
</resources>

seekbar_horizontal.xml

<?xml version="1.0" encoding="UTF-8"?>
<layer-list
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background" android:drawable="@drawable/seek_bkg" />
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
                <corners android:radius="2.0dip" />
                <gradient android:startColor="#80ffd300" android:endColor="#a0ffcb00" android:angle="270.0" android:centerY="0.75" android:centerColor="#80ffb600" />
            </shape>
        </clip>
    </item>
    <item android:id="@android:id/progress">
        <clip android:drawable="@drawable/seek" />
    </item>
</layer-list>

使用方法main.xml

    <SeekBar android:id="@+android:id/progresss"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:layout_marginTop="50dip" style="@style/Widget.SeekBar.Normal" />

seek.9.png

技术分享

seek_bkg.9.png

技术分享
seek_thumb.png

技术分享

Andorid 自定义seekbar

原文:http://www.cnblogs.com/zhujiabin/p/6034278.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!