Search code examples
androidalignmentpositionadsadmob

Android AdMob - Alignment/Position Ads


How do I make my ads display at the bottom of the screen?

I have tried setting gravity to bottom but it still won't budge.

Current page code:

<?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"
 android:background="@color/Background_Color">
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" 
  android:orientation="vertical"
  xmlns:myapp="http://schemas.android.com/apk/res/com.x.x" >
  <TextView android:id="@+id/out_text" 
   android:layout_height="fill_parent"
   android:layout_width="fill_parent"
   android:textSize="30dip" 
   android:textColor="@color/Text_Color" />

  <com.admob.android.ads.AdView
   android:id="@+id/ad"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   myapp:backgroundColor="#000000"
   myapp:primaryTextColor="#FFFFFF"
   myapp:secondaryTextColor="#CCCCCC"
   myapp:refreshInterval="10"
   android:visibility="visible" />
 </LinearLayout>
</ScrollView>

Any help would be greatly appreciated!


Solution

  • Try adding a weight to your TextView.

     android:layout_weight="1"
    

    This means, it will take up any open space of the parent.

    And add this to the ScrollView:

    android:fillViewport="true"