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 8022769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:21:54+00:00 2026-06-04T22:21:54+00:00

so i made a Surface view with a canvas, so i could do some

  • 0

so i made a Surface view with a canvas, so i could do some graphics. is there any way of having a xml layout with a canvas, so i can have buttons and what not on the screen, or is there any other option to making buttons on a canvas?

  • 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-04T22:21:56+00:00Added an answer on June 4, 2026 at 10:21 pm

    You will have to made one class that having that canvas in it. And then Import that class in the xml layout.

    See this example: FingerPaint Example.

    In above example there is myView class that contain the canvas to draw on it.

    What you need to do is:

    First Create any Layout in your xml as like below:

    <RelativeLayout
            android:id="@+id/drawingLayout"     
            android:layout_width="wrap_content"     
            android:layout_height="wrap_content">
    
        </RelativeLayout>
    

    Now let say main.xml is your main xml layout file then add that class in to that layout as like below:

       setContentView(R.layout.main);
    
        drawingLayout = (RelativeLayout)findViewById(R.id.drawingLayout);
        System.out.println("The Layout is: "+drawingLayout);
        myView = new MyView(this);
        drawingLayout.addView(myView);
    

    Hope you got the point. If not then let me know.

    Enjoy. :))

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

Sidebar

Related Questions

i need draw some stuff on canvas and then lick on each. I made
I have built a layout that can display a picture on three different areas.
i have made two view classes in first view class i am making more
I wish I could find this list before I made it. If for some
I have made a custom suface button according this example: <Button> <Button.Template> <ControlTemplate TargetType=Button>
Made a custom obj called Item with some string fields and one float. .h
I made the ultimate laugh generator using these rules. Can you implement it in
I`v made my webpart that works well (I can add it to page and
I have made a C++ library and have built a .dylib dynamic library from
I'm looking for a way to implement a surface (in C#, Windows Forms) where

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.