Android XML Error解析XML未绑定前缀

时间:2012-09-30 20:44:40

标签: android xml eclipse

我有2个错误,但我修复了一个。我仍然在com.admob.android.ads wats错误解析XML未绑定前缀错误?

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

1 个答案:

答案 0 :(得分:12)

您需要在主标记(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"
>