Android GridView和下面的广告

Android GridView和下面的广告,android,android-widget,android-layout,Android,Android Widget,Android Layout,我正在尝试将AdsAdMob整合到我的Android应用程序中。除了一个关于布局的问题外,它基本上都在工作。我的布局包括: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_par

我正在尝试将AdsAdMob整合到我的Android应用程序中。除了一个关于布局的问题外,它基本上都在工作。我的布局包括:

<?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>  
广告显示在屏幕底部,就像我想要的那样。但是,它们似乎覆盖或绘制在栅格视图底部的顶部。我希望gridview更短,这样广告就可以填充屏幕的底部,而不是隐藏gridview的一部分。当您一直滚动到gridview的底部,并且由于广告的原因,您仍然无法完全看到网格中的最后一行项目时,这个问题最令人恼火

我不确定这是否是AdMob广告工作的标准方式。如果是这样的话,如果可能的话,在网格底部添加一些填充将是一个好办法。这样,用户可以再滚动一点,看到广告之外的最后一行

在阅读了ListView的一些类似问题后,我刚从使用LinearLayout切换到RelativeLayout。现在我的广告是沿着底部而不是在网格上,所以我越来越近了

想法?
-Kevin

将此属性放在gridview中

android:layout_above="@+id/ad"

将此属性放在gridview中

android:layout_above="@+id/ad"