【问题标题】:not enough space for admob ads没有足够的空间放置 admob 广告
【发布时间】:2013-08-13 19:15:20
【问题描述】:

我了解没有足够空间来展示广告的问题,但我不知道如何解决。我猜有些东西占用了太多空间,但我不确定它到底是什么。我特别指的是 admob 广告而不是亚马逊广告。

这是日志猫:

08-13 19:09:42.972: ERROR/Ads(891): Not enough space to show ad! Wants: <480, 75>, Has: <432, 610>
08-13 19:09:42.972: ERROR/Ads(891): Not enough space to show ad! Wants: <480, 75>, Has: <432, 97>

这是我的 xml 文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:Amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads"
android:layout_height="match_parent"
android:background="@drawable/background5"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:id="@+id/MainLayout"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
tools:context=".MainActivity">


//start button
<Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Start"
        android:background="#19d2b2"
        android:id="@+id/start_button"
        android:layout_above="@+id/instructions_button5"
        android:layout_centerHorizontal="true"/>

//Instructions button
<Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Instructions"
        android:background="#19d2b2"
        android:id="@+id/instructions_button6"

        android:layout_below="@+id/start_button"
        android:layout_alignLeft="@+id/start_button"
        android:layout_marginTop="10dp"/>

<Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Gallery"
        android:background="#19d2b2"
        android:id="@+id/save_button"
        android:layout_below="@+id/instructions_button6"
        android:layout_alignParentRight="true"
        android:layout_marginTop="10dp"/>

<Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Scores"
        android:id="@+id/Scores"
        android:background="#19d2b2"
        android:layout_below="@+id/save_button"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"/>

<com.amazon.device.ads.AdLayout
        android:id="@+id/adview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        Amazon:adSize="320x75"
        android:layout_marginTop="400dp"/>

<com.google.ads.AdView android:id="@+id/adView"
                       android:layout_width="400dp"
                       android:layout_height="wrap_content"

                       ads:adUnitId="xxxxxxxxxxxxxxxx"
                       ads:adSize="BANNER"
                       android:layout_marginTop="300dp" android:layout_marginBottom="10dp"/>

【问题讨论】:

  • 我相信你可以删除像marginTop和marginBottom这样的额外边距,除非你真的需要它。
  • 这似乎可以解决问题,谢谢

标签: android admob space


【解决方案1】:

你已经用

配置了封闭的RelativeLayout
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"

这将减少 AdView 可用的水平空间量。删除这些,它应该可以工作。

【讨论】:

    【解决方案2】:

    删除

       android:paddingLeft="@dimen/activity_horizontal_margin"
       android:paddingRight="@dimen/activity_horizontal_margin"
       android:paddingTop="@dimen/activity_vertical_margin"
       android:paddingBottom="@dimen/activity_vertical_margin"
    

    从相对布局,你的问题就解决了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多