0

I have a scrollable text and ads at the bottom, but the ads doesn't go all the way to the bottom. Have tried RelativeLayout but if I use it, the ad sticks in the middle of the screen. Have been playing around a lot, but can't seem to make it stay at the bottom and have a scrollable text filling the rest of the screen.

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/box_background"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">



   <ScrollView
       android:id="@+id/ScrollView01"  
       android:layout_height="wrap_content"
       android:layout_width="fill_parent"
       android:padding="30dp">

    <TextView
        android:id="@+id/Button_2_Text"
        android:textColor="#000000"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:textSize="17dp"></TextView>
        </ScrollView>

    <com.google.ads.AdView 
    android:gravity="bottom"
    xmlns:ads="http://schemas.android.com/apk/res/com.aurumlabs.excuses"
    android:id="@+id/adView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    ads:adUnitId="a14f19b3aec0a93" 
    ads:adSize="BANNER"/>
    </LinearLayout>
Kevin
  • 321
  • 4
  • 21

5 Answers5

5

What if you tried using a RelativeLayout but set android:layout_above="@+id/adView" on the ScrollView as well as android:layout_alignParentBottom="true" for the AdView

There's a good blog post about this on the Google Ads Developer blog here

RajPara
  • 2,281
  • 1
  • 16
  • 9
  • I followed the instructions on their site and it worked in the end! Thank you very much! – Kevin Jan 29 '12 at 19:32
2

Set layout_weight=1 for your scroll view. This will make your ad to stick to the bottom.

manjusg
  • 2,275
  • 1
  • 22
  • 31
0

You have to set your com.google.ads.AdView's layout_gravity to bottom like this: android:layout_gravity="bottom"

Cata
  • 11,133
  • 11
  • 65
  • 86
0

Using RelativeLayout is the nice approch if you want the ads to be always positioned at the bottom.

This is exactly what you want https://stackoverflow.com/a/5188181/563306

Community
  • 1
  • 1
dcanh121
  • 4,665
  • 11
  • 37
  • 84
0

I haven't messed with admob yet; however I have a similar setup within one of my apps for a logo that is place on the bottom.

I have a layout that essentially follows this http://developer.android.com/resources/articles/layout-tricks-reuse.html

I used to include my main layout, and then the bottom logo. The first layout is set to wrap_content while the other is set to a specific dp. I'd have to double check; but regardless - I have ~50dp spot for my logo now. It works nicely.

Image: http://thomasbiddle.com/pics/3.png

TJ Biddle
  • 6,024
  • 6
  • 40
  • 47
  • When I get home, I can post a code snippet to show what I have exactly as well; however it's fairly close to the dev example android.com has. – TJ Biddle Jan 25 '12 at 20:39