Admob广告重叠SurfaceView

时间:2011-06-11 17:52:19

标签: android admob surfaceview overlap

我在android清单中使用了以下内容。

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.ads.AdView 
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:adUnitId="@string/admob_id"
    ads:adSize="BANNER"
    ads:loadAdOnCreate="true"
    android:background="#FF0000"
    />
<com.Joey_Ant.Lite.GameView
    android:id="@+id/gameScreen"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@id/adView"
    />
</RelativeLayout>

但是,广告仍然与surfaceview重叠(com.Joey_Ant.Lite.GameView)。

如何在广告加载时调整屏幕?

1 个答案:

答案 0 :(得分:1)

你可以试试看,它不会与surfaceview重叠,但即使广告没有加载也会留下广告空间

   <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.Joey_Ant.Lite.GameView
    android:id="@+id/gameScreen"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    />
<com.google.ads.AdView 
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    ads:adUnitId="@string/admob_id"
    ads:adSize="BANNER"
    ads:loadAdOnCreate="true"
    android:background="#FF0000"
    />

</LinearLayout>