【发布时间】:2013-12-01 10:32:59
【问题描述】:
我正在尝试在我的 web 视图中添加 AdMob,但效果不佳。在我的 main.xml 中,我写了这个:
<?xml version="1.0" encoding="utf-8"?>
<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"
android:gravity="center"
android:orientation="vertical" >
<WebView
android:id="@+id/webview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<com.google.ads.AdView android:id="@+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="1234567890"
ads:loadAdOnCreate="true"/>
</LinearLayout>
在主文件中我添加了:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
当我运行应用程序时,横幅未显示,logcat 显示:onFailedToReceiveAd(Invalid Ad request.) 我认为问题出在 ID 上,但我不明白我必须写哪个 id!我在“AdMob 控制台”中的 ID 只有数字,而不是 a14f3ed10a5e4eb 之类的东西
编辑: 我试着写:
ca-app-pub-****************/**********
其中 * 是数字。横幅出现但几秒钟后消失..
【问题讨论】:
标签: android webview android-webview admob