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.

enter image description here

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.

enter image description here

it impossible achieve standard progressbar. should consider creating custom view scratch.
can start here


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -