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

  • Home
  • SEARCH
  • 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 8126791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:16:45+00:00 2026-06-06T07:16:45+00:00

I created a drawing using different paths, but how can I move the entire

  • 0

I created a drawing using different paths, but how can I move the entire drawing? How can I selected and move it around? Here is the main part of my onDraw method:

Path theSymbol = new Path();

theSymbol.moveTo(0.0F, 0.0F);
theSymbol.lineTo(0.0F, 50.0F);
theSymbol.lineTo(16.666666F, 58.333332F);
theSymbol.lineTo(-16.666666F, 75.0F);
theSymbol.lineTo(16.666666F, 91.666664F);
theSymbol.lineTo(-16.666666F, 108.33333F);
theSymbol.lineTo(16.666666F, 124.99999F);
theSymbol.lineTo(-16.666666F, 141.66666F);
theSymbol.lineTo(0.0F, 150.0F);
theSymbol.lineTo(0.0F, 200.0F);
theSymbol.offset(100.0F, 20.0F);

canvas.drawPath(theSymbol, paint);

That’s how I draw a resistor to the screen (It works). Now I want some way of making all those paths be an object, something that I can select and move.

I have been looking at some projects like Sriracha, but I can’t find how they are doing their element drawings.

I have also searched countless times, but all I get is “moving something on a path”. Maibe I am searching for the wrong thing or this is not the way to do this kind of things.

I wold really appreciate if someone can point me in the right direction.

  • 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-06-06T07:16:47+00:00Added an answer on June 6, 2026 at 7:16 am

    Put this drawing code into the onDraw() method of a custom View subclass. Then you can place your drawings around the screen however you like using layouts, animations, and other transformations just like any other view in the framework. Something like:

    public class ResistorView extends View {
        private Path mSymbol;
        private Paint mPaint;
    
        //...Override Constructors...
        public ResistorView(Context context) {
            super(context);
            init();
        }
    
        public ResistorView(Context context, AttributeSet attrs) {
            super(context, attrs);
            init();
        }
    
        private void init() {
            mSymbol = new Path();
            mPaint = new Paint();
            //...Your code here to set up the path,
            //...allocate objects here, never in the drawing code.
        }
    
        //...Override onMeasure()...
        @Override
        public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            //Use this method to tell Android how big your view is
            setMeasuredDimension(width, height);
        }
    
        //...Override onDraw()...
        @Override
        public void onDraw(Canvas canvas) {
            super.onDraw(canvas);
    
            canvas.drawPath(mSymbol, mPaint);
        }        
    
    }
    

    For more information about creating custom views, check out the SDK docs.

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created different shapes like circle/rect etc in my program using BufferedPaintDC on
I'm trying to create a canvas for drawing different objects. I've created zoom and
I'm developing a painter program using HTML5 canvas. I have created a drawing tool
I've created a drawing using canvas which I intend to use multiple times for
I've created a project, added a reference to System.Drawing, and added a bmp file
I am trying to create a simple drawing game like DrawSomething. The problem here
i am using a series of linkbuttons A-z which are dynamically created what i
i want to show text using quartz 2d. Text will be drawing randomly on
I created my own parental control app using C# to monitor my kids activity.
I am drawing a string in a UIView using -drawRect:. This string may contain

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.