Android ScrollView and bottom AdMob overlap
I have a relative layout with a scrollview and a AdMob in it. The AdMob on the bottom overlaps the the scrollview so that the bottom part of the scrollview can never be seen. After a lot of trial and error I found that the solution is simple: set the ScrollView to android:layout_above="@+id/adView".
So the layout structure is something like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView_home"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/adView"
android:layout_alignParentTop="true"
android:background="@drawable/background"
android:orientation="vertical" >
.....
.....
.....
</ScrollView>
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="abcdefg"
ads:loadAdOnCreate="true" />
</RelativeLayout>
No comments:
Post a Comment