在drawable中创建一张图片progress_bar.xml:
引用这张图片:
对应的代码:
progressBar1.setProgressDrawable(getResources().getDrawable(R.drawable.progress_bar));
效果:
[img]http://dl.iteye.com/upload/attachment/419244/fafdb195-cadf-3b5b-bca3-857fbf5fbadb.png[/img]
progressBar常用方法:
[url]http://only81.iteye.com/blog/531242[/url]
[size=x-large][color=red]android圆形进度条颜色的设置[/color][/size]
其中的indeterminteDrawable属性就是用来设置进度条颜色等属性的,其内容如下:
Android自定义进度条-带文本(文字进度)的水平进度条(ProgressBar)
[url]http://orgcent.com/android-text-progressbar/[/url]
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="0"
/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#80ffd300"
android:centerColor="#80ffb600"
android:centerY="0.75"
android:endColor="#a0ffcb00"
android:angle="0"
/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners
android:radius="5dip" />
<gradient
android:startColor="#80ff0000"
android:endColor="#8000ff00"
android:angle="0" />
</shape>
</clip>
</item>
</layer-list>
引用这张图片:
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:progress="80"
android:secondaryProgress="90"
android:progressDrawable="@drawable/progress_bar"
/>
对应的代码:
progressBar1.setProgressDrawable(getResources().getDrawable(R.drawable.progress_bar));
效果:
[img]http://dl.iteye.com/upload/attachment/419244/fafdb195-cadf-3b5b-bca3-857fbf5fbadb.png[/img]
progressBar常用方法:
[url]http://only81.iteye.com/blog/531242[/url]
[size=x-large][color=red]android圆形进度条颜色的设置[/color][/size]
<ProgressBar
android:id="@+id/loadProgressBar"
android:indeterminateDrawable="@drawable/progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
其中的indeterminteDrawable属性就是用来设置进度条颜色等属性的,其内容如下:
<?xml version="1.0" encoding="utf-8"?>
<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="#000000"
android:centerColor="#FFFFFF"
android:centerY="0.50"
android:endColor="#FFFF00" />
</shape>
</rotate>
Android自定义进度条-带文本(文字进度)的水平进度条(ProgressBar)
[url]http://orgcent.com/android-text-progressbar/[/url]