zoukankan      html  css  js  c++  java
  • andorid 自定义seekbar

    效果如图:


    1. <?xml version="1.0" encoding="utf-8"?>  
    2. <resources>  
    3.    <style name="Widget.SeekBar.Normal" parent="@android:style/Widget.SeekBar">  
    4.         <item name="android:maxHeight">8.0dip</item>  
    5.         <item name="android:indeterminateOnly">false</item>  
    6.         <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item>  
    7.         <item name="android:progressDrawable">@drawable/seekbar_horizontal</item>  
    8.         <item name="android:minHeight">8.0dip</item>  
    9.         <item name="android:thumb">@drawable/seek_thumb</item>  
    10.         <item name="android:thumbOffset">10.0dip</item>  
    11.     </style>  
    12.       
    13.       
    14. </resources>  


    seekbar_horizontal.xml

    1. <?xml version="1.0" encoding="UTF-8"?>  
    2. <layer-list  
    3.   xmlns:android="http://schemas.android.com/apk/res/android">  
    4.     <item android:id="@android:id/background" android:drawable="@drawable/seek_bkg" />  
    5.     <item android:id="@android:id/secondaryProgress">  
    6.         <clip>  
    7.             <shape>  
    8.                 <corners android:radius="2.0dip" />  
    9.                 <gradient android:startColor="#80ffd300" android:endColor="#a0ffcb00" android:angle="270.0" android:centerY="0.75" android:centerColor="#80ffb600" />  
    10.             </shape>  
    11.         </clip>  
    12.     </item>  
    13.     <item android:id="@android:id/progress">  
    14.         <clip android:drawable="@drawable/seek" />  
    15.     </item>  
    16. </layer-list>  


    使用方法main.xml

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

    seek.9.png

    seek_bkg.9.png


    seek_thumb.png

    <?xml version="1.0" encoding="utf-8"?>

    <shape

        xmlns:android="http://schemas.android.com/apk/res/android"

        android:shape="oval"

        android:useLevel="false">

     

        <solidandroid:color="@color/red"/>

        <stroke

            android:width="1dp"

            android:color="@color/white"/>

        <sizeandroid:width="20dp"

              android:height="20dp"/>

    </shape>

     
  • 相关阅读:
    FileChannel的基本使用
    qq在线交流
    ci框架连接数据库
    绩效管理,如何实现“投资于人”?
    Asp.Net开发中传递的URL的长度问题
    ASP.NET程序中常用的三十三种代码
    认识ASP.NET配置文件Web.config
    JS实现图片幻灯片效果
    一些web开发中常用的、做成cs文件的js代码
    div自适应浏览器高度的问题
  • 原文地址:https://www.cnblogs.com/ldq2016/p/5543371.html
Copyright © 2011-2022 走看看