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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:53:19+00:00 2026-05-21T07:53:19+00:00

I’ve got AdMob working in my app, but it’s showing up at the bottom

  • 0

I’ve got AdMob working in my app, but it’s showing up at the bottom of my screen. Does anyone know how to force it to the top of the screen? I don’t want to use RelativeLayout as I already have a bunch of stuff set up with my LinearLayout.

I’m initiating AdMob via an @id reference in my main.xml and some calls in the java activity:

<?xml version="1.0" encoding="utf-8"?>

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
         android:id="@+id/linearLayout"   .....this is the only line I added for my Admob reference
         android:orientation="vertical"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         >

    <LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center">

    <ImageView android:id="@+id/ImageView01"
        android:src="@drawable/image01"
        android:layout_height="150dp"
        android:layout_width="200dp"
        android:scaleType="centerCrop"
        android:paddingTop="10px">
    </ImageView>

    </LinearLayout>
           ....

Then I have this in my java activity…

    setContentView(R.layout.main);

    //create an adView
    LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
    String pubID = "a14d9cfd23d60cf";
    AdView adView = new AdView(this, AdSize.BANNER, pubID);
    layout.addView(adView);
    AdRequest request = new AdRequest();

    //request.setTesting(true);
    adView.loadAd(request);

EDIT…..SOLUTION…….

Never mind…I got it figured out. It’s all about where you place the layout id. If I move android:id=”@+id/linearLayout” down into the LinearLayout just below the one it’s in now, My ad shows at the top.

  • 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-21T07:53:19+00:00Added an answer on May 21, 2026 at 7:53 am

    One way of going about this is by placing the ad view in your XML. What you do is put it just like any other view in the top of your view hierarchy under the root LinearLayout. In other words, you will have something like:

    <LinearLayout
    android:id="@+id/linearLayout"   .....this is the only line I added for my Admob reference
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
      <com.google.ads.AdView android:id="@+id/adView"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             ads:adUnitId="MY_AD_UNIT_ID"
                             ads:adSize="BANNER"/>
        <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center">
    
        <ImageView android:id="@+id/ImageView01"
            android:src="@drawable/image01"
            android:layout_height="150dp"
            android:layout_width="200dp"
            android:scaleType="centerCrop"
            android:paddingTop="10px">
        </ImageView>
    
        </LinearLayout>
    

    Take a look at http://code.google.com/mobile/ads/docs/android/banner_xml.html for more info on this.

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

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms

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.