Vote count:
0
I am trying to animate circle with different color combination according to the percentage which a task has been completed,but when i try to change the color of the paint,whole circle color seems to change,It would be a great favor if anyone could guide me in the right direction. Following is the Canvas Class Draw Method
@Override
protected synchronized void onDraw(Canvas canvas) {
canvas.drawArc(mCircleBounds, 110, 320 , false, mBackgroundColorPaint);
int prog = getProgress();
float scale = getMax() > 0 ? (float)prog/getMax() *320: 0;
if(mHasShadow)
mProgressColorPaint.setShadowLayer( 3, 0, 1, mShadowColor);
canvas.drawArc(mCircleBounds, 110, scale , false, mProgressColorPaint);
if(!TextUtils.isEmpty(mTitle)){
int xPos = (int)(getMeasuredWidth()/2 - mTitlePaint.measureText(mTitle) / 2);
int yPos = (int) (getMeasuredHeight()/2);
float titleHeight = Math.abs(mTitlePaint.descent() + mTitlePaint.ascent());
if(TextUtils.isEmpty(mSubTitle)){
yPos += titleHeight/2;
}
canvas.drawText(mPercentageIndicator, xPos, yPos, mSubtitlePaint);
}
super.onDraw(canvas);
}
Following is the link to the style.xml
<style name="Widget.ProgressBar.CircularProgressBar" parent="Widget">
<item name="hasShadow">true</item>
<item name="strokeWidth">55</item>
<item name="PercentageCounter"></item>
<item name="subtitle"></item>
</style>
Kindly Help me through this :( Any help would be Appreciated,or Guide me in the right direction,Thanks
asked 38 secs ago
Fill Canvas Hollow Circle With Different Colors According To Percentage(Gradient)
Aucun commentaire:
Enregistrer un commentaire