Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text with multiple line doesn't work #60

Open
arnaudbarbe opened this issue Sep 15, 2015 · 4 comments
Open

Text with multiple line doesn't work #60

arnaudbarbe opened this issue Sep 15, 2015 · 4 comments

Comments

@arnaudbarbe
Copy link

create an ProgressWheel and setText with \n
lines overlap

@arnaudbarbe
Copy link
Author

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();
    }
}

@Todd-Davies
Copy link
Owner

I believe this is related to 57b1075.

@narimetisaigopi
Copy link

have you solved this problem?

@narimetisaigopi
Copy link

narimetisaigopi commented Dec 27, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants