How to add two colors in progress bar in android? -
i trying add 2 colors in progress bar. in project there button called "increase". when press increase , holds progress bar increases yellow color, trying when release "increase" button progress bar should add small bar green color.
my problem when release button whole progress bar getting filled green color instead of yellow color till hold button , small bar @ releasing button.
i attaching screenshot.
below code snippet
if (i == 0) { progressbar1.setprogress(progressbar1.getprogress() + 10); progressbar1.setprogressdrawable(getresources().getdrawable( r.drawable.progress_layer)); = 1; } else { progressbar1.setprogress(progressbar1.getprogress() + 1); progressbar1.setprogressdrawable(getresources().getdrawable( r.drawable.progress_layer_normal)); }
here 0 default when tap , holds button progress bar increase yellow color. when release button becomes 1 , green color bar should added progress bar. whole progress bar becomes green.
it impossible achieve standard progressbar. should consider creating custom view scratch.
can start here
Comments
Post a Comment