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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:23:27+00:00 2026-05-24T08:23:27+00:00

I am creating an android game, I tried using the canvas.drawText() method to display

  • 0

I am creating an android game, I tried using the canvas.drawText() method to display my score and level but it caused errors. Now I am trying to use TextViews to display them, I am using a SurfaceVeiw and I wanted to know is it possible and would it be a good way of doing it.

  • 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-24T08:23:30+00:00Added an answer on May 24, 2026 at 8:23 am

    You can’t really put TextViews into a SurfaceView. What you can do instead, though, is add TextViews on top of the SurfaceView. Let me know if you need help on doing that if you don’t know how.

    // You can use a FrameLayout to hold the surface view
    FrameLayout frameLayout = new FrameLayout(this);
    frameLayout.addView(surfaceView);
    
    // Then create a layout to hold everything, for example a RelativeLayout
    RelativeLayout relativeLayout= new RelativeLayout(this);
    relativeLayout.addView(frameLayout);
    relativeLayout.addView(textview1);
    relativeLayout.addView(textview2);
    setContentView(relativeLayout);
    

    When adding your views, it may be helpful to using LayoutParams to help organize things. Use this documentation for LayoutParams. Hope this helps!

    If you’re using an XML layout, I would use a RelativeLayout, as mentioned above, contain the SurfaceView inside a FrameLayout. Placing the TextView’s on top of the FrameLayout is just a simple matter of configuring the RelativeLayout parameters for each view. You seem new to Android, perhaps this guide will help you with RelativeLayouts and XML layouts in general.

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

Sidebar

Related Questions

Im currently creating a tile-based game for android. Using java via dalvik JVM. im
I am creating an android game using opengl and a cocos2d port (http://code.google.com/p/cocos2d-android-1). I
I am creating a matching game for Android, and when the user gets a
While creating a file synchronization program in C# I tried to make a method
Ahoy, I'm working on an OpenGL ES based game for Android using the NDK.
I am creating a game using the irrlicht c++ 3D graphics engine port to
I'd like to start creating Android apps but I don't like Java. I read
So, I'm both new to Java and to creating android apps, but not new
I am developing a game for the Android platform using flash cs5 and AS3.
I am creating a twitter sharing by using sugree's twitter-android-sdk . So when the

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.