2011-06-11 46 views
0

我在android清单中使用了以下内容。Admob Ad重叠SurfaceView

<?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> 

但是,广告仍与曲面视图重叠(com.Joey_Ant.Lite.GameView)。

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

回答

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>