eclipse Android XML 错误解析 XML 未绑定前缀

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12664964/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:06:23  来源:igfitidea点击:

Android XML Error parsing XML unbound prefix

androidxmleclipse

提问by badmanthe5

I had 2 errors but i got one fixed. I still have the Error parsing XML unbound prefix error thou at the com.admob.android.ads wats wrong?

我有 2 个错误,但我修复了一个。我在 com.admob.android.ads 上仍然有 Error parsing XML unbound prefix error 你错了吗?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
/>

<com.admob.android.ads.AdView
  android:id="@+id/ad" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
  xmlns:backgroundColor="#000000"
  xmlns:primaryTextColor="FFFFFF"
  xmlns:secondaryTextColor="#CCCCCC"
  android:layout_alignParentTop="true"
  ads:adUnitId="xxxxxxxxxxxx"
  ads:adSize="BANNER"
  ads:loadAdOnCreate="true"
  /> 
</RelativeLayout>     

回答by onof

You need to set layout configuration on the main tag (RelativeLayout) and to set the namespace of ads:

您需要在主标签(RelativeLayout)上设置布局配置并设置广告的命名空间:

<RelativeLayout
    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"
>