在TabbedView上方添加AdMob广告?

当我尝试将AdMob广告引用放在选项卡式视图上方时,我收到“解析XML文件时出错:未绑定前缀”。任何想法如何解决?
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout android:orientation="vertical"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:padding="5dp">
        <com.admob.android.ads.AdView android:id="@+id/ad"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF"
            myapp:secondaryTextColor="#CCCCCC" />
        <TabWidget android:id="@android:id/tabs"
            android:layout_width="fill_parent" android:layout_height="wrap_content" />
        <FrameLayout android:id="@android:id/tabcontent"
                android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>
    
已邀请:
你正在使用这个:
myapp:backgroundColor
但我没有看到'myapp'前缀的任何声明。这可能是错误的根源。 就像在xml中声明“android”命名空间一样:
xmlns:android="http://schemas.android.com/apk/res/android"
'myapp'命名空间也应该在某个地方声明     
这个答案似乎有关系。 正如Nanne所说,你需要正确设置
xmlns
,以及
res/style/attrs.xml
中定义的属性。
xmlns
似乎是:
xmlns:admob="http://schemas.android.com/apk/res/com.example.package"
例如
attrs.xml
,请查看上面的答案。     

要回复问题请先登录注册