Skip to content Skip to sidebar Skip to footer

Android Admob Not Enough Space To Show Ad

Used the code provided in admob site Here is my xml

Solution 1:

Your grid is taking up all the space with layout_height="fill_parent".

You can use layout_weight="1" and layout_height="0dp" to tell the grid to take up all the remaining space after other views are shown.

Also are you adding the AdView programmatically? You can place it in the xml below the GridView.

Ex:

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/background_img"android:orientation="vertical"android:id="@+id/atozlayout"
     ><GridViewandroid:id="@+id/gridView1"android:numColumns="auto_fit"android:columnWidth="55dp"android:stretchMode="columnWidth"android:layout_width="fill_parent"android:layout_height="0dp"android:layout_weight="1"android:horizontalSpacing="10dp"android:verticalSpacing="10dp"></GridView><com.google.ads.AdViewandroid:id="@+id/adView"android:layout_width="match_parent"android:layout_height="wrap_content"ads:adUnitId="MY_AD_UNIT_ID"ads:adSize="BANNER"ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"ads:loadAdOnCreate="true"/></LinearLayout>

Make sure you replace adUnitId with your value.

Solution 2:

Your gridView is greedy. Its eats all available space on the screen. The solution is to switch the top level layout to a Relative layout, and add android:layout_above"@+id/adview" to the GridView and android:layout_alignParentBottom=true to the ad view. This will force the gridview to leave room beneath it for the ad.

Solution 3:

According to the Android tab on the page which you linked, you need a <com.google.ads.AdView> view in your layout which seems to be missing from your original post.

Post a Comment for "Android Admob Not Enough Space To Show Ad"