当前位置:首页 > Android > 正文内容

Andorid 自定义seekbar

jsc9年前 (2016-09-23)Android6255

效果如图:

1.gif

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

2.gif

seek_bkg.9.png

3.gif

seek_thumb.png

4.gif

扫描二维码推送至手机访问。

版权声明:本文由微小站发布,如需转载请注明出处。

本文链接:https://jsc0.com/post/142.html

标签: seekbar
分享给朋友:

“Andorid 自定义seekbar” 的相关文章

EditText焦点

<LinearLayout          style="@style/FillWrapWidgetStyle"      &n...

google Zxing实现二维码、条形码扫描,仿微信二维码扫描效果

google Zxing实现二维码、条形码扫描,仿微信二维码扫描效果

    了解二维码这个东西还是从微信中,当时微信推出二维码扫描功能,自己感觉挺新颖的,从一张图片中扫一下竟然能直接加好友,不可思议啊,那时候还不了解二维码,呵呵,然后做项目的时候,老板说要加上二维码扫描功能,然后自己的屁颠屁颠的去百度,google...

实现应用程序只有在第一次启动时显示引导界面

第一次安装启动:启动页--->导航页-->主页面之后启动:启动页-->主页面实现的原理就是:在启动页面用做一个文件保存的状态,保存程序是不是第一次启动的状态。因为只是要保存一个状态,我们将这个程序是第一次打开就将他设为true,当他进入 主页面之后将他的状态未为false,因为都...

Fragment保持状态切换

Fragment保持状态切换

在使用Activity管理多个Fragment时,每次切换Fragment使用的是replace,结果导致出现xxx is not currently in the FragmentManager异常挂掉网上说使用replace切换会使被切换的Fragment给替换掉,从而被被切换的Fra...

采用SharedPreferences保存用户偏好设置参数

采用SharedPreferences保存用户偏好设置参数-------------------------------------------------1.eclipse就是通过xml来保存用户的偏好设置-->window-->perfences-------------------...

采用SharedPreferences保存用户偏好设置参数和读取设置参数

采用SharedPreferences保存用户偏好设置参数和读取设置参数

Android SDK支持那些文件存储技术? 1. 使用SharedPreferences保存key-value类型的数据 2. 流文件存储(使用openFileOutput和openFileInput方法,或FileInputStream和FileO...