错误:解析XML时出错:admob中的未绑定前缀

时间:2013-01-08 16:28:17

标签: android xml layout admob

我尝试了很多组合,但它在xml文件中显示以下错误

  

错误:解析XML时出错:未绑定前缀

<com.google.ads.AdView行中,我该如何解决此问题。

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
         xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        >
        <RelativeLayout
         android:layout_width="wrap_content"         
         android:layout_height="wrap_content"         
         android:layout_alignParentBottom="true" > 
    <com.google.ads.AdView
            android:id="@+id/ad"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            myapp:adUnitId="000000000000000"
            myapp:adSize="BANNER"
            myapp:refreshInterval="30"
         />
        </RelativeLayout>
       <ListView
            android:id="@+id/list_of_wishes"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:dividerHeight="2dip"

            android:clickable="true" >
               </ListView>


    </LinearLayout>

1 个答案:

答案 0 :(得分:13)

我想你应该使用ads:代替myapp:,但我可能错了。如果这不适合您,请告诉我:

<com.google.ads.AdView
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adUnitId="000000000000000"
        ads:adSize="BANNER"
        ads:refreshInterval="30"
     />

这可能有所帮助的原因是你设置了一个ads命名空间,而不是myapp(如本行所示):

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"