I have used the following in android manifest.
<?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.goog开发者_运维知识库le.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>
However, the ad still overlaps the surfaceview (com.Joey_Ant.Lite.GameView).
How do I make the screen adjust when the ad loads?
You can try this it wont overlap surfaceview but it will leave the ad space even if ad doesnt load
<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>
精彩评论