0

タブ付きビューの上に 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>
4

2 に答える 2

2

あなたはこれを使用しています:

myapp:backgroundColor

しかし、「myapp」プレフィックスの宣言は見当たりません。それがエラーの原因である可能性があります。

「android」名前空間が次のように xml で宣言されているように:

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

「myapp」名前空間にも宣言が必要です

于 2011-03-09T16:27:44.043 に答える
1

この答えは関連しているようです。

xmlnsナンネが言ったように、セットと で定義された属性の両方が必要ですres/style/attrs.xml

次のxmlnsように見えます:

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

例については、attrs.xml上記の回答をご覧ください。

于 2011-03-09T16:44:21.000 に答える