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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:31:25+00:00 2026-05-28T14:31:25+00:00

How do I prevent my Android screen from shifting down when a page is

  • 0

How do I prevent my Android screen from shifting down when a page is view is displayed and receives the first add?

When the view is first displayed the screen is normal, then a ad is displayed and the screen shifts down a few lines.

Here is my code.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background3"
android:orientation="vertical" >

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="2dp"
    android:layout_gravity="top"
    ads:adSize="BANNER"
    ads:adUnitId="xxxxxxxxxx"
    android:gravity="center"
    ads:loadAdOnCreate="true" >
</com.google.ads.AdView>

<TableRow
    android:id="@+id/tableRow2"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:layout_marginTop="34dp" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        android:text="Start" />

</TableRow>

</LinearLayout>

TIA, Trey

  • 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-28T14:31:26+00:00Added an answer on May 28, 2026 at 2:31 pm

    I don’t have much experience with the ads. But from strictly a View standpoint it seems like what is happening is that the adView is set to View.GONE before it loads. Which means that its space is ignored when placing the other views into the parent.

    I don’t know for sure how you could get it to not do that. But I would try explicitly setting it to android:visibility="invisible" in your xml, then in your java you’ll have to make it visible after it has loaded. “invisible” is like gone, but it tells the parent to respect the space that you will take up when you are visible.

    Perhaps the loadOnCreate attribute causes the behavior you are seeing? Might also be worth trying it without that and just load it manually in your onCreate.

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

Sidebar

Related Questions

this link shows How to prevent Custom Views from losing state across screen orientation
In Android 2.3 and below, you could make an application full screen, and then
How can I prevent my app from showing in Android Market on large and
To prevent impatient users from clicking on a link to a webstart application too
How do I prevent vim from replacing spaces with tabs when autoindent is on?
Is it possible to prevent an asp.net Hyperlink control from linking, i.e. so that
Does TCP/IP prevent multiple copies of the same packet from reaching the destination? Or
How do I prevent my users from accessing directly pages meant for ajax calls
How can I prevent a user from resizing GridViewColumns withing a ListView control?
I'm new to Android development and am having an issue with my first app's

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.