Hi,
I'm trying to integrate ads (admob) into my Android app. It's mostly working, except for one issue with the layout. My layout consists of:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res/com.example.photos">
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/status_layout">
<ImageView android:id="@+id/cardStatus"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello"
android:id="@+id/cardStatusText" />
</LinearLayout>
<GridView android:id="@+id/imageGridView"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="10dp" android:verticalSpacing="10dp"
android:horizontalSpacing="10dp" android:numColumns="auto_fit"
android:columnWidth="100dp" android:stretchMode="columnWidth"
android:gravity="center" android:layout_below="@id/status_layout" />
<!-- Place an AdMob ad at the bottom of the screen. -->
<!-- It has white text on a black background. -->
<!-- The description of the surrounding context is 'Android game'. -->
<com.admob.android.ads.AdView android:id="@+id/ad"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" app:backgroundColor="#000000"
app:primaryTextColor="#FFFFFF" app:secondaryTextColor="#CCCCCC"
app:keywords="Android Photo" />
</RelativeLayout>
The ads are shown at the bottom of the screen, just as I want. However, they seem to be overlayed or drawn on top of the bottom portion of the grid view. I would like the gridview to be shorter, so that the ad can fill the bottom portion of the screen, and not hide part of the gridview. The problem is most annoying when you scroll all the way to the bottom of the gridview, and you still cannot fully see the last row items in the grid due to the ad.
I'm not sure if this is the standard way that AdMob ads work. If this is the case, adding some padding to the bottom of the grid (if that's possible) would due the trick. That way the user can scroll a bit further, and see the last row in addition to the ad.
I just switched from using LinearLayout to RelativeLayout after reading some similar issues with ListViews. Now my ad is along the bottom instead of above the grid, so I'm getting closer.
Thoughts?
-Kevin