I am adding ads to my app (This is my first time) but it always overlap with my content (i.e. it is shown over my content).
My xml is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidsam="http://schemas.android.com/apk/res/com.jameselsey"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/home_layout"
android:orientation="vertical"
android:layout_height="wrap_content"
android:background="@drawable/background">
<TextView
android:id="@+id/my_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:text="TextView2"
android:textColor="#ffffff"
android:textColorHighlight="#000000"
android:shadowColor="#000000"
android:shadowDx="3"
android:shadowDy="-3"
android:shadowRadius="1.5"
android:fadingEdge="horizontal"
android:typeface="serif"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
/>
</LinearLayout>
<LinearLayout
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:id="@+id/ad_layout"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a14f26e5d930307"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, 33334750709D00EC"
ads:loadAdOnCreate="true"/>
</LinearLayout>
</RelativeLayout>
The ad is shown at the bottom of the screen but it hides the end of the TextView!
Any ideas to do this without overlapping with the TextView ?
Thanks in advance 🙂
You can use structure as given below. Align adView to
android:layout_alignParentBottom="true"and align your LinearLayout above this adView by setting LinearLayout’s attribute toandroid:layout_above="@id/adView".