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

Andorid 自定义seekbar

jsc9年前 (2016-09-23)Android6494

效果如图:

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” 的相关文章

使用自定义RadioButton和ViewPager实现TabHost效果和带滑动的页卡效果。

使用自定义RadioButton和ViewPager实现TabHost效果和带滑动的页卡效果。

在工作中又很多需求都不是android系统自带的控件可以达到效果的,内置的TabHost就是,只能达到简单的效果 ,所以这个时候就要自定义控件来达到效果:这个效果就是: 使用自定义RadioButton和ViewPager实现TabHost带滑动的页卡效果。    &...

EditText焦点

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

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

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

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

GridView中item高度自适应

item高度自适应public class MyAdapter extends BaseAdapter {         GridView mGv;&n...

onTextChanged参数解释及实现EditText字数监听

由于最近做项目要检测EditText中输入的字数长度,从而接触到了Android中EditText的监听接口,TextWatcher。它有三个成员方法,第一个after很简单,这个方法就是在EditText内容已经改变之后调用,重点看下面两个方法:beforeTextChanged(CharSequ...

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

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

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