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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:25:35+00:00 2026-06-02T02:25:35+00:00

I have a class within my game which I copied from a tutorial: public

  • 0

I have a class within my game which I copied from a tutorial:

public class PanelThing extends SurfaceView implements SurfaceHolder.Callback
{
}

I never quite understood how this class worked, but it seems to do the job and my game has been working fine for some time. This PanelThing seems to operate a bit like some kind of Layout. In my game’s onCreate method I have:

pt = new PanelThing(this);
game_play_layout = new LinearLayout(this);
game_play_layout.addView(pt);
setContentView(game_play_layout);

Now I need to have a child layout within pt. I tried doing pt.addView(my_child_layout), but addView is undefined within pt. Is it possible to modify PanelThing, perhaps with “extends” or “implements” so that addView becomes defined? Or is there some other way I can add a layout to pt?

EDIT: If you want to know exactly why I want a child layout for pt, see this question.

  • 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-02T02:25:37+00:00Added an answer on June 2, 2026 at 2:25 am

    a SurfaceView is not a layout container like LinearLayout so you can’t add views to it. It’s more like an interactive image you draw in your code all the time.

    You’ll either have to add the additional information you want to display to the drawing code of your SurfaceView or you could layout it on top of your SurfaceView using a FrameLayout. Make sure that the layout on top is transparent in those regions you don’t want to block the content below.

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <PanelThing 
           android:layout_width="match_parent"
           android:layout_height="match_parent" />
    
        < -- Layout on top here. --
           android:layout_width="match_parent"
           android:layout_height="match_parent" />
    
    </FrameLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a class which represents a person, a variable within that class
I have been trying to return a collection from a property within a class
If I have a class called myclass does having static methods within the class
I have a class library that has settings within an app.config. I know that
I have a generic class that takes a type T . Within this class
I have a property within a class, that I need to iterate through all
I have subclassed a UITableViewCell and within this class I want to get it's
I have a menu within a page, I have an active class applied to
Say I have a method, and within that method it instantiates a Person class:
I have the following thats within a loop... echo <span class='srch-val'>.apply_filters( $value\n, $value).</span>; I

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.