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

Andorid 自定义seekbar

jsc9年前 (2016-09-23)Android6289

效果如图:

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

Android开发中Bundle用法 包裹数据

SDK里是这样描述:A mapping from String values to various Parcelable types。  它帮助我将数据打包传入intent里面,为使用这些数据提供了便利。protected void onListItemClick (L...

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

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

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

java.util.Properties类

java.util.Properties类

一、认识properties文件   1、properties文件是一个文本文件 2、properties文件的语法有两种,一种是注释,一种属性配置。  注    释...

Android中Parcelable接口用法

1. Parcelable接口Interface for classes whose instances can be written to and restored from a Parcel。 Classes implementing the Parcelable interface m...

Android 学习之 开源项目PullToRefresh的使用

Android 学习之 开源项目PullToRefresh的使用

首先 下载 Android-PullToRefresh-master 下载地址  https://github.com/chrisbanes/Android-PullToRefresh 下载之...

Android中的消息通知(NotificationManager和Notification)

下面来谈谈notification,这个notification一般用在电话,短信,邮件,闹钟铃声,在手机的状态栏上就会出现一个小图标,提 示用户处理这个通知,这时手从上方滑动状态栏就可以展开并处理这个快讯。已添加的Notification.Builder,使其更容易构建通知。 notifica...