Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7489245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:13:11+00:00 2026-05-29T15:13:11+00:00

I would like to learn how to draw vertical text on the canvas. Sorry

  • 0

I would like to learn how to draw vertical text on the canvas. Sorry for maybe stupid question, but I can not solve this problem. I can do so:

 if (i ==10)
      {
          this_str2 = "0.00";
      }  


              canvas.save();
              canvas.rotate(-90,190,90);
              canvas.drawText(this_str2,  x_guide +50, drawSizes[1] + drawSizes[3]  -  (i *    drawSizes[3] / 10) +20, paint);
              canvas.restore();
      }

But it is not properly displayed on the X and Y is any other solution to this problem 7

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:13:12+00:00Added an answer on May 29, 2026 at 3:13 pm

    Try this custom textview, I don’t remember where I took if from (here in StackOverflow), if any one remembers, please post a link in the comments.

    import android.content.Context;
    import android.graphics.Canvas;
    import android.text.TextPaint;
    import android.util.AttributeSet;
    import android.view.Gravity;
    import android.widget.TextView;
    
    public class VerticalTextView extends TextView
    {
        final boolean topDown;
    
        public VerticalTextView(Context context, AttributeSet attrs)
        {
            super(context, attrs);
            final int gravity = getGravity();
            if (Gravity.isVertical(gravity) && (gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM)
            {
                setGravity((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.TOP);
                topDown = false;
            }
            else
                topDown = true;
        }
    
        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
        {
            super.onMeasure(heightMeasureSpec, widthMeasureSpec);
            setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
        }
    
        @Override
        protected void onDraw(Canvas canvas)
        {
            TextPaint textPaint = getPaint();
            textPaint.setColor(getCurrentTextColor());
            textPaint.drawableState = getDrawableState();
    
            canvas.save();
    
            if (topDown)
            {
                canvas.translate(getWidth(), 0);
                canvas.rotate(90);
            }
            else
            {
                canvas.translate(0, getHeight());
                canvas.rotate(-90);
            }
    
            canvas.translate(getCompoundPaddingLeft(), getExtendedPaddingTop());
    
            getLayout().draw(canvas);
            canvas.restore();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to learn how to use TFS2010, but I can't find any
This can easily be scripted, but I would like to learn how to do
I would like to learn how I can use nested template tags where the
I would like to learn Assembly Programming for Windows. But I am having some
I would like to learn what are the scenarios/usecases/ where messaging like RabbitMQ can
I would like to learn how a program can be written and installed without
I would like to learn Clojure, but rather than opening up a full-on IDE
I would like to learn about creating a program that I could draw simple
My 7 year old would like to learn, how to program? (his idea not
I would like to learn SSIS 2008. can any one guide me to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.