Android 布局 XML 中 AdMob 的正确 xmlns url 是什么 [英] What is correct xmlns url for AdMob in Android Layout XML

查看:11
本文介绍了Android 布局 XML 中 AdMob 的正确 xmlns url 是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试适用于 Android SDK 的 AdMob.我无法设置 admob:testing="true" 因为 admob 属性未知.

I am testing the AdMob for Android SDK. I can't set the admob:testing="true" because the admob attribute is unknown.

<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" 会有一个未知前缀.有人知道如何解决这个问题吗?

My Eclipse is complaining that admob:testing="true" would have an unknown prefix. Anyone got an idea on how to fix this?

子问题:有人知道如何更改广告的高度吗?它似乎固定为 48px,在任何 DROID 手机上看起来都不是很好......

Sub question: Anyone got an idea how to change the height of the ad? It seems to be fixed to 48px, which is not looking good on any DROID phone...

推荐答案

可能值得检查错误不是由于文件之外的东西引起的:

Might be worth checking that the error isn't due to something outside the file:

确保您在架构 URI 中使用的包名称org.ifies.android"与 AndroidManifest.xml 中清单元素上的包属性值匹配.

Make sure the package name you are using in your schema URI, "org.ifies.android", matches the value of the package attribute on the manifest element in AndroidManifest.xml.

确保 res/values/attrs.xml 具有指定的属性:

Make sure res/values/attrs.xml has the attributes specified:

<?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>

这篇关于Android 布局 XML 中 AdMob 的正确 xmlns url 是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆