ProgressWheel icon indicating copy to clipboard operation
ProgressWheel copied to clipboard

Text with multiple line doesn't work

Open arnaudbarbe opened this issue 9 years ago • 4 comments

create an ProgressWheel and setText with \n lines overlap

arnaudbarbe avatar Sep 15 '15 14:09 arnaudbarbe

try this in ProgressWheel.java

protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    //Draw the inner circle
    canvas.drawArc(innerCircleBounds, 360, 360, false, circlePaint);
    //Draw the rim
    canvas.drawArc(circleBounds, 360, 360, false, rimPaint);
    canvas.drawArc(circleOuterContour, 360, 360, false, contourPaint);
    //canvas.drawArc(circleInnerContour, 360, 360, false, contourPaint);
    //Draw the bar
    if (isSpinning) {
        canvas.drawArc(circleBounds, progress - 90, barLength, false, barPaint);
    } else {
        canvas.drawArc(circleBounds, -90, progress, false, barPaint);
    }
    //Draw the text (attempts to center it horizontally and vertically)
    float textHeight = textPaint.descent() - textPaint.ascent();

    float startingOffset = (textHeight * splitText.length) / 2 - (textHeight / 4);

    for (int i = (splitText.length - 1) ; i >=0  ; i--) {
        float horizontalTextOffset = textPaint.measureText(splitText[i]) / 2;
        canvas.drawText(
                splitText[i],
                this.getWidth() / 2 - horizontalTextOffset,
                this.getHeight() / 2 + startingOffset,
                textPaint);

                startingOffset = startingOffset - textHeight;
    }
    if (isSpinning) {
        scheduleRedraw();
    }
}

arnaudbarbe avatar Sep 15 '15 15:09 arnaudbarbe

I believe this is related to 57b1075.

Todd-Davies avatar Sep 17 '15 13:09 Todd-Davies

have you solved this problem?

narimetisaigopi avatar Dec 27 '18 11:12 narimetisaigopi

i did not get any official support from team. i created custom view with progresswheel it has worked for me check that code here https://pastebin.com/FZ0YSxSe

narimetisaigopi avatar Dec 27 '18 11:12 narimetisaigopi