
我制作了一个简单的应用,并在其中添加了广告,但该广告未显示在设备中.
而且我的代码中没有错误:
xml页面:
<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:ads="http://schemas.androID.com/apk/res-auto" xmlns:tools="http://schemas.androID.com/tools" androID:ID="@+ID/relativeLayout1" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" tools:context=".MainActivity" > <com.Google.androID.gms.ads.AdVIEw xmlns:app="http://schemas.androID.com/apk/libs/com.Google.ads" androID:ID="@+ID/adVIEw" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParenttop="true" androID:layout_centerHorizontal="true" androID:layout_margintop="66dp" ads:adSize="BANNER" ads:adUnitID="ad_ip" > </com.Google.androID.gms.ads.AdVIEw> </relativeLayout>清单文件:
<uses-permission androID:name="androID.permission.INTERNET" /> <uses-permission androID:name="androID.permission.ACCESS_NETWORK_STATE" /> <uses-permission androID:name="com.Google.androID.gms.permission.ACTIVITY_RECOGNITION" ></uses-permission> <Meta-dataandroID:name="com.Google.androID.gms.version"androID:value="4.3.23" /><activity androID:name="com.Google.androID.gms.ads.AdActivity" androID:configChanges="keyboard|keyboardHIDden|orIEntation|screenLayout|uiMode|screenSize|smallestScreenSize" /> 解决方法:
我认为问题出在这里
<com.Google.androID.gms.ads.AdVIEw xmlns:app="http://schemas.androID.com/apk/libs/com.Google.ads" androID:ID="@+ID/adVIEw" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParenttop="true" androID:layout_centerHorizontal="true" androID:layout_margintop="66dp" ads:adSize="BANNER" ads:adUnitID="ad_ip" >1)xmlns属性应该是这样,在我的情况下,我已将其放置在xml文件的根标记中.
xmlns:ads="http://schemas.androID.com/apk/res-auto"2)检查,您是否已经从admob帐户中获得了实际的adUnitID.
希望这会对您有帮助,如果您有任何其他问题,可以询问.
总结以上是内存溢出为你收集整理的android-admob广告没有显示全部内容,希望文章能够帮你解决android-admob广告没有显示所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)