Android AdMob未显示在webview中
我正在尝试在我的webview中添加AdMob,但没有效果。。在main.xml中,我写了以下内容:Android AdMob未显示在webview中,android,webview,android-webview,admob,Android,Webview,Android Webview,Admob,我正在尝试在我的webview中添加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:
<?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>
其中*是数字。横幅出现,但几秒钟后消失。您应该使用的Admob AdUnitId应该如下所示:
ca-app-pub-****************/**********
所以你走对了方向
你会得到
onFailedToReceiveAd(Invalid Ad request.)
当没有可显示的广告时
ca-app-pub-****************/**********
onFailedToReceiveAd(Invalid Ad request.)