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

Kis*_*pta 1 xml layout android 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>
Run Code Online (Sandbox Code Playgroud)

kar*_*ark 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"
     />
Run Code Online (Sandbox Code Playgroud)

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

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
Run Code Online (Sandbox Code Playgroud)