什么是Android的布局XML正确的xmlns网址适用于AdMob
题
我测试AdMob广告为Android SDK。因为AdMob的属性是未知的我不能设置admob:testing="true"
。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:admob="http://schemas.android.com/apk/res/org.ifies.android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FF000000"
android:clickable="true"
>
<com.admob.android.ads.AdView
android:id="@+id/admob"
android:visibility="visible"
android:layout_width="fill_parent"
android:layout_height="100px"
android:background="#FF0000"
admob:testing="true"
/>
</LinearLayout>
我的Eclipse是抱怨admob:testing="true"
将有一个未知的前缀。任何人有关于如何解决此问题的想法?
子问题:任何人有一个想法如何改变广告的高度?这似乎是固定在48像素,这是不找任何的Droid手机...
这是好的解决方案
可能是值得检查错误不是由于文件之外的东西:
请确保您使用您的模式URI包名“ org.ifies.android”,在AndroidManifest.xml中manifest元素的package属性的值相匹配。
确认RES /值/ attrs.xml已指定的属性:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.admob.android.ads.AdView">
<attr name="testing" format="boolean" />
<attr name="backgroundColor" format="color" />
<attr name="textColor" format="color" />
<attr name="keywords" format="string" />
<attr name="refreshInterval" format="integer" />
<attr name="isGoneWithoutAd" format="boolean" />
</declare-styleable>
</resources>
其他提示
这花了我一段时间来弄清楚,所以我在这里张贴:
由于AdMob的4.1这已经改变,所以以前的答案为版本<= 4.04正确。现在,你需要使用:
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
对于自己的包没地方在新的模式,也不需要一个attrs.xml文件。
这里详细说明: http://groups.google。 COM /组/谷歌的AdMob的广告-SDK / browse_thread /线程/ 3b885d3fe5bb21a5?PLI = 1个(Tim的交,这是从顶部第8次)
不隶属于 StackOverflow