布局Adview - 解析XML未绑定前缀时出错

时间:2014-04-16 15:55:43

标签: android admob

我的代码是:     

//Error parsing XML: unbound prefix error
<com.google.ads.AdView
   android:id="@+id/adView"
   android:layout_width="wrap_content"
   andorid:layout_height="wrap_content"
   ads:adSize="BANNER"

   ads:adUnitId=""

   ads:loadAdOnCreate="true"
   ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
/>

<WebView 
    android:id="@+id/webkit"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
/>  

</LinearLayout>

有什么问题?我不知道。

我尝试更改&#34; xmlns:ads =&#34; http://schemas.android.com/apk/lib/com.google.ads"到&#34; android:ads =&#34; http://schemas.android.com/apk/lib/com.google.ads",但它无法解决

2 个答案:

答案 0 :(得分:1)

试试这个..

android更改了

andorid:layout_height 拼写错误并进行了尝试。

android:layout_height="wrap_content"

答案 1 :(得分:0)

andorid:layout_height更改为android:layout_height="wrap_content" 参考下面的布局示例:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    android:background="#000000"
    android:orientation="vertical" >

    <com.google.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            ads:adSize="BANNER"
            ads:adUnitId="AD_UNIT_ID"
            ads:loadAdOnCreate="true"
            ads:testDevices="TEST_EMULATOR"
            />


    <FrameLayout
        android:id="@+id/rootFrameLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />


</LinearLayout>