SeekBar配置文件:

view plain copy to clipboard print ?
  1. <SeekBar
  2. android:id="@+id/player_seekbar"
  3. android:layout_width="245px"
  4. android:layout_height="25px"
  5. android:progressDrawable="@drawable/seekbar_style"
  6. android:thumb="@drawable/thumb"
  7. android:paddingLeft="16px"
  8. android:paddingRight="15px"
  9. android:paddingTop="5px"
  10. android:paddingBottom="5px"
  11. android:progress="0"
  12. android:max="0"
  13. android:secondaryProgress="0"
  14. />

android:progressDrawable="@drawable/seekbar_style"背景条

seekbar_style配置如下:

Xml代码
  1. <?xmlversion="1.0"encoding="UTF-8"?>
  2. <layer-listxmlns:android="http://schemas.android.com/apk/res/android">
  3. <itemandroid:id="@android:id/background">
  4. <shape>
  5. <cornersandroid:radius="5dip"/>
  6. <gradient
  7. android:startColor="#ff9d9e9d"
  8. android:centerColor="#ff5a5d5a"
  9. android:centerY="0.75"
  10. android:endColor="#ff747674"
  11. android:angle="270"
  12. />
  13. </shape>
  14. </item>
  15. <itemandroid:id="@android:id/secondaryProgress">
  16. <clip>
  17. <shape>
  18. <cornersandroid:radius="5dip"/>
  19. <gradient
  20. android:startColor="#80ffd300"
  21. android:centerColor="#80ffb600"
  22. android:centerY="0.75"
  23. android:endColor="#a0ffcb00"
  24. android:angle="270"
  25. />
  26. </shape>
  27. </clip>
  28. </item>
  29. <itemandroid:id="@android:id/progress">
  30. <clip>
  31. <shape>
  32. <cornersandroid:radius="5dip"/>
  33. <gradient
  34. android:startColor="#ff0099CC"
  35. android:centerColor="#ff3399CC"
  36. android:centerY="0.75"
  37. android:endColor="#ff6699CC"
  38. android:angle="270"
  39. />
  40. </shape>
  41. </clip>
  42. </item>
  43. </layer-list>

或者:用图片如下:

Xml代码
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <layer-listxmlns:android="http://schemas.android.com/apk/res/android">
  3. <itemandroid:id="@android:id/background"
  4. android:drawable="@drawable/progress_bg"/>
  5. <itemandroid:id="@android:id/secondaryProgress"
  6. android:drawable="@drawable/second_progress">
  7. </item>
  8. <itemandroid:id="@android:id/progress"
  9. android:drawable="@drawable/first_progress">
  10. </item>
  11. </layer-list>

方形

Xml代码
  1. <layer-listxmlns:android="http://schemas.android.com/apk/res/android">
  2. <itemandroid:id="@android:id/background"
  3. android:drawable="@drawable/progress_bg"/>
  4. <itemandroid:id="@android:id/secondaryProgress">
  5. <clipandroid:drawable="@drawable/second_progress"/>
  6. </item>
  7. <itemandroid:id="@android:id/progress">
  8. <clipandroid:drawable="@drawable/first_progress"/>
  9. </item>
  10. </layer-list>

android:thumb="@drawable/thumb"就是那个会动的球

配置如下:

Xml代码
  1. <?xmlversion="1.0"encoding="UTF-8"?>
  2. <selectorxmlns:android="http://schemas.android.com/apk/res/android">
  3. <!-- 按下状态-->
  4. <item
  5. android:state_focused="true"
  6. android:state_pressed="true"
  7. android:drawable="@drawable/thumb_pressed"/>
  8. <!-- 普通无焦点状态 -->
  9. <item
  10. android:state_focused="false"
  11. android:state_pressed="false"
  12. android:drawable="@drawable/thumb_normal"/>
  13. <!-- 有焦点状态-->
  14. <item
  15. android:state_focused="true"
  16. android:state_pressed="false"
  17. android:drawable="@drawable/thumb_focused"/>
  18. <!-- 有焦点 -->
  19. <item
  20. android:state_focused="true"
  21. android:drawable="@drawable/thumb_focused"/>
  22. </selector>

更多相关文章

  1. [置顶] AndroidStudio快捷键
  2. Android蓝牙通信代码
  3. Android(安卓)之ContextMenu上下文菜单
  4. Android(安卓)- ImageView 加边框 实例
  5. Android重启应用程序代码
  6. android studio 56 下载网络歌曲 代码
  7. android 模拟器上GPS的使用
  8. 开发Android硬件抽象层代码
  9. android常用代码

随机推荐

  1. SQL Server 不存在或访问被拒绝(转)
  2. Java 实现连接sql server 2000
  3. sql 多条件组合查询,并根据指定类别找出所
  4. sql 随机抽取几条数据的方法 推荐
  5. 对有insert触发器表取IDENTITY值时发现的
  6. SQL SERVER 查询正在实行的SQL语句
  7. SQL语句查询是否为空 =null及null
  8. SQLserver 实现分组统计查询(按月、小时分
  9. SQL Server日志过大会影响查询结果
  10. sqlserver 数据库日志备份和恢复步骤