AdMob的广告没有显示出来,但一个简单的按钮 [英] admob ads are not showing up but a simple button is
本文介绍了AdMob的广告没有显示出来,但一个简单的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个的manifest.xml
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.fcporto" android:versionCode="1" android:versionName="0.1">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<application android:icon="@drawable/logo" android:label="@string/app_name">
<activity android:name=".Principal" android:configChanges="orientation|keyboardHidden" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity><activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
</application></manifest>
和我的main.xml是
and my main.xml is
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<TabWidget android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@android:id/tabs"></TabWidget>
<FrameLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@android:id/tabcontent">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#013364"
android:id="@+id/tab1">
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="@+id/listView2"
android:background="#efefef" android:cacheColorHint="#00000000"></ListView>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#013364"
android:id="@+id/tab2">
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="@+id/listView1"
android:background="#efefef" android:cacheColorHint="#00000000"></ListView>
</LinearLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/tab3">
<WebView android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/webview"/>
</RelativeLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#013364"
android:id="@+id/tab4">
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="@+id/listView3"
android:background="#efefef" android:cacheColorHint="#00000000"></ListView>
</LinearLayout>
</FrameLayout>
</LinearLayout><LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<com.google.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="my_unit_id" ads:adSize="BANNER" ads:loadAdOnCreate="true" android:layout_gravity="bottom"/></LinearLayout></TabHost>
如果我更换这
<com.google.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="my_unit_id" ads:adSize="BANNER" ads:loadAdOnCreate="true" android:layout_gravity="bottom"/>
通过简单的按钮,这个工程。我的思念与AdMob的是什么?
by a simple button, this works. What i am missing with the admob?
感谢
推荐答案
两种可能性:
- 您没有与您的实际AdMob的发布者ID替换my_unit_id。
- 在没有任何广告展示。请记住,在广告请求的填充率不是100%。检查你的logcat的输出。如果你看到一个消息,说像广告请求成功,但没有返回广告由于缺乏库存,那么就意味着没有广告是可用的。
这篇关于AdMob的广告没有显示出来,但一个简单的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文