Android admob广告不会出现

Android admob广告不会出现,android,admob,ads,Android,Admob,Ads,我已经成功地让我的admob广告出现在Google在提供的示例代码中,但当涉及到我自己的应用程序时,它们不会出现 我已经阅读了一些相关的问题,但对于我正在使用的线性布局来说,这似乎不是一个问题。需要注意的是,在我的应用程序中,它扩展了ListActivity而不是Activity <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.co

我已经成功地让我的admob广告出现在Google在提供的示例代码中,但当涉及到我自己的应用程序时,它们不会出现

我已经阅读了一些相关的问题,但对于我正在使用的线性布局来说,这似乎不是一个问题。需要注意的是,在我的应用程序中,它扩展了ListActivity而不是Activity

   <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:ads="http://schemas.android.com/apk/res/com.mypackage.myapp" 
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent">
      <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2">

        <com.google.ads.AdView android:id="@+id/adView"                          
            android:layout_width="wrap_content"                          
            android:layout_height="fill_parent"                          
            ads:adUnitId="myadmobid"                          
            ads:adSize="BANNER"/>  
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2">
        <TextView
            android:id="@+id/hottopictab"
            android:text="Deal"
            android:gravity="center_horizontal|center_vertical"
            android:background="#000000"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:textStyle="bold"
      android:typeface ="sans"
            android:layout_weight="1"/>

        <TextView
            android:id="@+id/newtopictab"
            android:text="()"
            android:gravity="center_horizontal|center_vertical"
            android:background="#000000"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:textStyle="bold"
      android:typeface ="sans"
            android:layout_weight="1"/>

        <TextView
            android:id="@+id/recommendtab"
            android:text=""
            android:gravity="center_horizontal"
            android:background="#000000"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>

    <ImageButton 
            android:layout_height="fill_parent"
            android:id="@+id/refresh"
            android:background="#000000"
            android:src="@drawable/refresh"     
            android:layout_width="wrap_content" 
            android:layout_marginRight="6dip"    
        /> 


   </LinearLayout>            
   <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="40">

        <ListView
            android:id="@android:id/list"
            android:text="row one"
            android:textSize="15pt"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"/> 

    </LinearLayout>      
</LinearLayout>

将admob设置为测试帐户。然后,您将能够看到这是Admob问题还是代码问题


另外,检查Logcat-可能是因为目前没有任何广告可供您使用。

当您使用应该填充广告的活动/方法时,请检查您的Logcat。我遇到了一个问题,因为横幅需要50个垂直空间,所以它无法显示,而我只给了它50像素,而不是同样的东西。LogCat会给你一个警告,说它无法放入所需的空间

还有,你打电话来吗

AdView adView = (AdView)this.findViewById(R.id.adView);
        adView.loadAd(new AdRequest());
在你的活动中?你必须申请一个广告,他们不会自动加载

还有一件事,在布局中放置广告时,需要确保有一个attrs.xml文件,如adMob教程所示

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <declare-styleable name="com.google.ads.AdView">
      <attr name="adSize">
          <enum value="1" name="BANNER"/>
          <enum name="IAB_MRECT" value="2"/>
          <enum name="IAB_BANNER" value="3"/>
          <enum name="IAB_LEADERBOARD" value="4"/>
      </attr>
      <attr format="string" name="adUnitId"/>
  </declare-styleable>
</resources>

我在几个小时前实施Admob时遇到了这个问题

我所做的是进入我的admob帐户,并将应用程序设置为为未填充的库存提供“内部广告”

然后,我设置了一个虚假的内部广告,我打算后者制作一个广告来购买该应用程序的非广告版本

这意味着,如果您从应用程序中请求admob发布广告,但当前没有需求,则会显示您的内部广告


希望这有助于问题的解决。这是因为没有足够的空间没有足够的空间来显示广告!想要:,有:。当我放大模拟器时,它工作了。

等待30分钟对我来说很有效。我重新启动了应用程序,添加项出现。

我已将其设置为测试帐户。request.settingtrue;当我运行/调试我的应用程序时,我确实看到我的admod帐户不时收到新的请求。如何检查logcat呢?在Eclipse的DDMS视图中检查logcat选项卡。