AdMob广告占用了所有屏幕空间

时间:2014-03-07 19:50:35

标签: android layout background admob

经过长时间的广告投放问题,它终于有效了。 但现在我的AdMob广告在其视图/布局中添加了黑色背景(我不知道) 所以我的游戏不再可见了。广告本身的大小正是我想要的, 但我需要摆脱这种奇怪的黑色背景。

我怀疑我在布局方面做错了什么:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="ca-app-pub-4118138803752321/8641047294"
    android:orientation="vertical" />

</RelativeLayout>

究竟出了什么问题?

2 个答案:

答案 0 :(得分:0)

因为它是RelativeLayout,请指定AdView的位置,这应该解决您的问题。

答案 1 :(得分:0)

在RelativeLayout中指定Adview的位置。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
 >

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="ca-app-pub-4118138803752321/8641047294"
    />
</RelativeLayout>
相关问题