-1

I have used the following in android xml. Whenever I'm scrolling the page the admob ad is overlapping the some part of Image from bottom.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#31352e" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="match_parent"
                android:layout_height="330dp"
                android:background="@drawable/pic_one"
                android:scaleType="fitXY" />

            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="fill_parent"
                android:layout_height="330dp"
                android:layout_margin="5dp"
                android:background="#fff"
                android:scaleType="fitXY"
                android:src="@drawable/pic_two" />

            <ImageView
                android:id="@+id/imageView3"
                android:layout_width="fill_parent"
                android:layout_height="330dp"
                android:layout_margin="5dp"
                android:background="#fff"
                android:scaleType="fitXY"
                android:src="@drawable/pic_three" />

            <ImageView
                android:id="@+id/imageView4"
                android:layout_width="fill_parent"
                android:layout_height="330dp"
                android:layout_margin="5dp"
                android:background="#fff"
                android:scaleType="fitXY"
                android:src="@drawable/pic_four" />

            <ImageView
                android:id="@+id/imageView5"
                android:layout_width="fill_parent"
                android:layout_height="330dp"
                android:layout_margin="5dp"
                android:background="#fff"
                android:scaleType="fitXY"
                android:src="@drawable/pic_five" />
        </LinearLayout>
    </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="ID here"
        ads:loadAdOnCreate="true"
        ads:testDevices="TEST_EMULATOR" />

</RelativeLayout>

However, the ad still overlaps the ImageView

How do I make the screen adjust when the ad loads?

Laxmeena
  • 780
  • 2
  • 7
  • 28
  • 1
    add `android:layout_above="@id/adView"` to `ScrollView`.. right now it fills the parent and hence the overlap. – hypd09 Jun 02 '14 at 12:40

2 Answers2

0
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/g"
        android:gravity="center"
        android:orientation="horizontal" >

              <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@color/black"
            android:gravity="center"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/activity_main_content_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:paddingBottom="8dp"
                android:paddingTop="8dp"
                android:text="APPLICATION NAME"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </LinearLayout>
    </LinearLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="4.12"
        android:background="@color/white" >

        <ImageView
            android:id="@+id/Large_image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@drawable/icn" />



         </RelativeLayout>

  <RelativeLayout
        android:id="@+id/rel"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
        android:background="@color/darkblue" >

  <com.google.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
            android:id="@+id/ad"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
           ads:adSize="BANNER"
             ads:loadAdOnCreate="true"
            ads:adUnitId="MY KEY " />  
    </RelativeLayout>


</LinearLayout>
Android
  • 8,995
  • 9
  • 67
  • 108
-1

the best way to have a ImageView ads is using FrameLayout, it'll simply makes a layer on top of current layout

Namini40
  • 100
  • 7
  • (This post does not seem to provide a [quality answer](https://stackoverflow.com/help/how-to-answer) to the question. Please either edit your answer, or just post it as a comment to the question). – sɐunıɔןɐqɐp Jun 10 '18 at 11:18