-2

I have design a horizontal progressBar using xml,But I want color of progressBar color gradient change when progressBar Increase. As per given view in Image.

start color and end color with horizontal gradient

Ramchandra Singh
  • 530
  • 4
  • 15
  • http://stackoverflow.com/questions/2020882/how-to-change-progress-bars-progress-color-in-android – Junaid Hafeez Jan 23 '17 at 11:42
  • Create a drawable, see this: http://stackoverflow.com/questions/2819778/custom-drawable-for-progressbar-progressdialog – AsfK Jan 23 '17 at 11:42
  • Possible duplicate of [How to change progress bar's progress color in Android](http://stackoverflow.com/questions/2020882/how-to-change-progress-bars-progress-color-in-android) – AJay Jan 23 '17 at 11:42
  • Hi guys thanks for response ,But i am not talking about color Change I would like to change progressColor change like gradient view, means start color and end color different, @junaid hafeez,@asfk,@ajay. – Ramchandra Singh Jan 23 '17 at 11:48
  • @RamchandraSingh see, i have posted an answer for you. lemme know if it is helpful. – Junaid Hafeez Jan 23 '17 at 12:20

2 Answers2

0

Hello you need to create custom horizontal progress bar for that

this question also asked her

How to create Custom Horizontal progress bar

here is official blog

http://developer.android.com/reference/android/widget/ProgressBar.html

Community
  • 1
  • 1
AJay
  • 1,233
  • 10
  • 19
0

make a drawable file an putt this code in it

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Define the background properties like color etc -->
    <item android:id="@android:id/background">
        <shape>
            <solid
                android:color="#ffb833"
                android:angle="270"
                />
        </shape>
    </item>

    <!-- Define the progress properties like start color, end color etc -->
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                <solid
                    android:color=" #f3d59d "
                    android:angle="270"
                    />
            </shape>
        </clip>
    </item>
</layer-list>

and in your xml of progressbar add this line

android:progressDrawable="@drawable/your_drawable_file_name"
android developer
  • 114,585
  • 152
  • 739
  • 1,270
Junaid Hafeez
  • 1,618
  • 1
  • 16
  • 25