Bill Mote
Bill Mote

Reputation: 12823

Add an AdMob Ad above a TabbedView?

I am getting an "Error parsing XML file: Unbound prefix" when I try to put my AdMob ad reference above a tabbed view. Any ideas how to fix that?

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

Upvotes: 0

Views: 1018

Answers (2)

Matthew
Matthew

Reputation: 44919

This answer seems related.

You need both the xmlns set correctly, as Nanne said, as well as your attributes defined in res/style/attrs.xml.

The xmlns appears to be:

xmlns:admob="http://schemas.android.com/apk/res/com.example.package"

For an example attrs.xml, check out the answer above.

Upvotes: 1

Nanne
Nanne

Reputation: 64429

You're using this:

myapp:backgroundColor

but I don't see any declaration of the 'myapp' prefix. so that might be the source of the error.

Just like the "android" namespace is declared in the xml like this:

xmlns:android="http://schemas.android.com/apk/res/android"

the 'myapp' namespace should have a declaration somewhere also

Upvotes: 2

Related Questions