ProgressBar 颜色的设置
2012-12-12 15:20
169 查看
转载自:http://blog.csdn.net/mars2639/article/details/6620836
布局文件代码:
此XML文件新建在drawable目录下:文件名为:progressbar
至于设置水平进度条的颜色:
progressbar_drawable.xml如下:
布局文件代码:
<ProgressBar android:id="@+id/progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminateDrawable="@drawable/progressbar" />
此XML文件新建在drawable目录下:文件名为:progressbar
<?xml version="1.0" encoding="utf-8"?> <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="360"> <shape android:shape="ring" android:innerRadiusRatio="3" android:thicknessRatio="8" android:useLevel="false"> <gradient android:type="sweep" android:useLevel="false" android:startColor="#6BD3FF" android:centerColor="#FF7121" android:centerY="0.50" android:endColor="#FFFF00" /> </shape> </animated-rotate>
至于设置水平进度条的颜色:
<LinearLayout android:gravity="center" android:orientation="horizontal" android:padding="10dp" android:layout_width="fill_parent" android:layout_height="wrap_content"> <SeekBar android:layout_gravity="center" android:id="@android:id/progress" android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:paddingBottom="4.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:maxHeight="2.0px" android:progressDrawable="@drawable/progressbar_drawable" android:minHeight="2.0px" android:thumb="@drawable/seekbar_thumb" style="?android:attr/progressBarStyleHorizontal" /> </LinearLayout>
progressbar_drawable.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"> <shape> <corners android:radius="2.0dip" /> <gradient android:startColor="#ff000000" android:centerColor="#ff000000" android:endColor="#ff000000" android:angle="270.0" android:centerY="2.0" /> </shape> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="2.0dip" /> <gradient android:startColor="#ff33b5e5" android:centerColor="#ff33b5e5" android:endColor="#ff33b5e5" android:angle="270.0" android:centerY="2.0" /> </shape> </clip> </item> </layer-list>
相关文章推荐
- material progressbar颜色设置
- 不确定(indeterminateProgressBar)进度条的颜色设置
- android ProgressBar水平进度条的颜色设置
- Android UI --- 设置ProgressBar的颜色
- 不确定(indeterminateProgressBar)进度条的颜色设置
- 玩转ProgressBar,设置渐变效果,同时设置两个进度的颜色显示!!!
- Android学习札记6:ProgressBar圆形进度条的颜色设置
- 设置progressbar的背景颜色
- android设置长条progressbar背景颜色
- 不确定(indeterminateProgressBar)进度条的颜色设置
- ProgressBar 自定义颜色、在代码中设置颜色
- Android学习札记7:ProgressBar水平进度条的颜色设置
- 为ProgressBar进度条设置颜色1
- 设置progressbar进度条颜色
- Android UI 设置ProgressBar的颜色
- Android笔记: ProgressBar 圆形进度条颜色的设置
- 安卓学习笔记---ProgressBar水平进度条的颜色设置
- 安卓ProgressBar水平进度条的颜色设置
- 不确定(indeterminateProgressBar)进度条的颜色设置
- Android 在代码里动态设置ProgressBar的颜色