Reputation: 341
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>
Upvotes: 0
Views: 992
Reputation: 2263
Set layout_weight=1 for your scroll view. This will make your ad to stick to the bottom.
Upvotes: 2
Reputation: 6494
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
Upvotes: 0
Reputation: 4695
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
Upvotes: 0
Reputation: 2281
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
Upvotes: 5
Reputation: 11211
You have to set your com.google.ads.AdView's layout_gravity to bottom like this: android:layout_gravity="bottom"
Upvotes: 0