andorid xml 修改 seekbar 式样

自定义SeekBar样式与实现
本文详细介绍了如何通过XML修改SeekBar的样式,包括修改其高度、进度绘制、背景颜色等属性,提供了具体代码示例及效果展示。

欢迎大家访问我的博客http://blog.youkuaiyun.com/mikejaps专注于android ios  app 开发


很多人喜欢叫此文 为 自定义seekbar,个人感觉称之为 xml 修改seekbar 式样 更合适,毕竟我们只是修改了一些属性,这些都是google 提供给我们设置的

效果如图:



<?xml version="1.0" encoding="utf-8"?>  
02.<resources>  
03.   <style name="Widget.SeekBar.Normal" parent="@android:style/Widget.SeekBar">  
04.        <item name="android:maxHeight">8.0dip</item>  
05.        <item name="android:indeterminateOnly">false</item>  
06.        <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item>  
07.        <item name="android:progressDrawable">@drawable/seekbar_horizontal</item>  
08.        <item name="android:minHeight">8.0dip</item>  
09.        <item name="android:thumb">@drawable/seek_thumb</item>  
10.        <item name="android:thumbOffset">10.0dip</item>  
11.    </style>  
12.      
13.      
14.</resources>



<?xml version="1.0" encoding="UTF-8"?>  
02.<layer-list  
03.  xmlns:android="http://schemas.android.com/apk/res/android">  
04.    <item android:id="@android:id/background" android:drawable="@drawable/seek_bkg" />  
05.    <item android:id="@android:id/secondaryProgress">  
06.        <clip>  
07.            <shape>  
08.                <corners android:radius="2.0dip" />  
09.                <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>  



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




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

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值