Sud*_*Som 7 android progress-bar
我试图改变水平进度条的颜色,但它没有改变.我做了一些谷歌搜索,并通过你的网站给出的一些例子.但我没有成功地准确地改变颜色.我使用progressBar.setProgressDrawable(Drawable d)但它设置整个进度条视图的背景颜色,而不是仅设置条本身的背景颜色.
拜托,任何身体帮助我.
谢谢
You Can create custom_progress.xml file in drawable folder -
<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="2"
android:thicknessRatio="6" android:useLevel="false">
<size android:width="76dip" android:height="76dip" />
<gradient android:type="sweep" android:useLevel="false"
android:startColor="#c76a37"
android:endColor="#A4B4B9"
/>
</shape>
</rotate>
//And add below code to your layout file to create progress bar
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="68dp"
android:progressDrawable="@drawable/custom_progress"
/>
Hope this will help you.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9005 次 |
| 最近记录: |