我有一个关于Admob不显示广告的问题...
这是LogCat:
我曾尝试过测试模式、非测试模式、模拟器、真实手机等多种方式,但从未看到任何显示内容。然而,我在Admob统计数据中收到了请求和打印信息,就好像它曾经工作过一样...
据我所知,我已经按照Admob Android SDK的要求进行了所有操作...唯一可能导致问题的原因,我认为是我正在使用带有ScrollView的选项卡布局,然后是一个RelativeLayout,在其中广告显示...
以下是选项卡布局的示例:
这是LogCat:
WARN/AdMobSDK(502): Ignoring requestFreshAd() because we are requesting an ad right now already.
INFO/AdMobSDK(502): No fill. Server replied that no ads are available (1164ms)
INFO/AdMobSDK(502): No fill. Server replied that no ads are available (846ms)
我曾尝试过测试模式、非测试模式、模拟器、真实手机等多种方式,但从未看到任何显示内容。然而,我在Admob统计数据中收到了请求和打印信息,就好像它曾经工作过一样...
据我所知,我已经按照Admob Android SDK的要求进行了所有操作...唯一可能导致问题的原因,我认为是我正在使用带有ScrollView的选项卡布局,然后是一个RelativeLayout,在其中广告显示...
以下是选项卡布局的示例:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.xxx.xxx"
android:id="@+id/tababout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF000000">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF000000"
android:padding="10px">
<ImageView
android:id="@+id/label_img"
android:src="@drawable/about_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="centerInside" />
<TextView android:id="@+id/label_know_more_desc"
style="@style/Desc"
android:layout_below="@id/label_img"
android:text="@string/tab_about_know_more_desc" />
<Button android:id="@+id/bt_know_more"
style="@style/Button"
android:gravity="center_vertical|center_horizontal"
android:layout_below="@id/label_know_more_desc"
android:text="@string/tab_about_know_more_bt" />
<com.admob.android.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" />
</RelativeLayout>
</ScrollView>
这里是main.xml文件,不过我觉得你可能不需要它:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF000000">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF000000"
android:paddingTop="5px">
</FrameLayout>
</LinearLayout>
</TabHost>
我在Admob ads will not display when placed inside a tabview中读到,问题可能是我加入的10像素填充,但即使我禁用它,也不起作用。
我甚至尝试将xmlns:myapp移动到RelativeLayout中,但显然没有改变任何东西....
此外,我已经进行了第一次实时广告请求超过24小时了...
编辑
好的,现在我有所进展,我已经成功显示测试广告(我的setTestDevices太晚了,在onCreate代码中我将其提前到了第一行),但没有真正的广告...我漏掉了什么吗?我显然注释了setTestDevices这一行,没有广告显示出来
编辑2
好的,我添加了两个内部广告(我已经启用了内部广告,但没有设置内部广告),突然间广告开始在我的应用程序上显示出来(不仅仅是内部广告)。
我想所有这些都让它工作了?! :)
谢谢大家!
android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="50dip"
myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" android:layout_gravity="center_horizontal|top" /> 这是一个程序相关的内容,其中包含了一些Android布局的代码。 - HaMMeReD
AdManager.TEST_EMULATOR, // Android 模拟器 "MyKey", // } ); - HaMMeReD