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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:43:51+00:00 2026-05-22T01:43:51+00:00

I create a game which has a custom view derived from surfaceView. and in

  • 0

I create a game which has a custom view derived from surfaceView. and in the game I want to place adView below the gameView. but the problem is , if I place adView below the gameView , the adView wont show up.. I do all the layouting in the code because its easier to maintain..

here is the code..

If i place the adView above the gameView it will show up

private RelativeLayout layout;   //the gameView container
private LinearLayout mainLayout;  //the main layout
private RocketView rocketView;   //the gameView
private AdView adView;             //the adView
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

        mainLayout = new LinearLayout(this);
        mainLayout.setOrientation(LinearLayout.VERTICAL);

        adView = new AdView(this, AdSize.BANNER, "a14d9e9ea3740e8");
        adView.setVisibility(AdView.VISIBLE);
        adView.loadAd(new AdRequest());
        mainLayout.addView(adView);   // -->> here i place the adView first

        layout = new RelativeLayout(this);
        mainLayout.addView(layout);   //--->> then i place the gameView later

        rocketView = new RocketView(this);
        layout.addView(rocketView);
        setContentView(mainLayout);
}

But if i place the adView below it won’t show up.

private RelativeLayout layout;
private LinearLayout mainLayout;
private RocketView rocketView;
private Launcher launcher;

private AdView adView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        mainLayout = new LinearLayout(this);
        mainLayout.setOrientation(LinearLayout.VERTICAL);

        layout = new RelativeLayout(this);
        mainLayout.addView(layout);

        rocketView = new RocketView(this);
        layout.addView(rocketView);

        adView = new AdView(this, AdSize.BANNER, "a14d9e9ea3740e8");
        adView.setVisibility(AdView.VISIBLE);
        adView.loadAd(new AdRequest());
        mainLayout.addView(adView);
        setContentView(mainLayout);

}

I think I know what happen..
after adView loading the adRequest and get the ads, its not streching above, but it streching below, so it not showing in the screen. but I don’t know how to solve this problem. please help me..

  • 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-22T01:43:52+00:00Added an answer on May 22, 2026 at 1:43 am

    First, there is no need for your linear layout, mainLayout. Add both rocketView and adView to your relativelayout, layout. Give adView the attributes align_parent_bottom, wrap_content (height) and wrap_content or fill_parent for width. Then give rocketView fill_parent for width and height and have it be “above” adView.

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

Sidebar

Related Questions

I want to create a game that will work both locally and online. My
I want to create a game that starts with 3 green dots on the
How can I create board for simple game, looks like for chess,but user could
I'm writing an iOS game (Using UIView), which has a randomly generated 2D city.
I'm writing an online game which allows a user to progress from one puzzle
I am trying to create a scene graph for my 3D game in which
I am making a game which has a global (static) class called MedGameController. In
I'm trying to create a custom control in WPF to display the game tree
I have written a checkers game model which has a Board object that holds
I've this question from an assignment to create a Store which rent out books,

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.