效果如:
在xml布局文件中设置:
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="109dp"
android:layout_height="80dp"
android:background="@drawable/qq"
android:progressDrawable="@drawable/my_progress_bar_horizontal" />
其中my_progress_bar_horizontal文件在drawable文件夹下:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/progress">
<clip
android:clipOrientation="vertical"
android:gravity="bottom" >
<shape>
<corners android:radius="5dip" />
<gradient
android:angle="270"
android:centerY="0.75"
android:centerColor="#55ff00cc"
android:centerX="0.75"
android:endColor="#55ff00cc"
android:startColor="#55ff00cc" />
</shape>
</clip>
</item>
</layer-list>
嘿嘿,是不是很简单,里面的一些属性自己去查查什么东东咯。