zoukankan      html  css  js  c++  java
  • andorid——自定义seekbar(转)

    xml

    新建=>xml=>values

    <?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

    文件要在res=>drawable目录下新建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

  • 相关阅读:
    10/11
    el表达式的坑
    在idea下两个项目之间的maven父子级项目依赖
    树上任意两点间距离
    优先级顺序
    HDU 6447
    KMP
    cf 1029 C
    牛客练习赛25
    莫比乌斯算法
  • 原文地址:https://www.cnblogs.com/Chenshuai7/p/5431584.html
Copyright © 2011-2022 走看看