2012-05-10 22 views
0

私のアプリケーションに私のadmob広告を配置する際に問題があります。以下のコードでは、エラーが表示されます。 error parsing XML: unbound prefixAndroid:admob広告を配置

私はそれを修正するように見えません。何が間違っているのですか?広告を掲載する別の方法はありますか?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/mainLayout"  
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 


    <com.admob.android.ads.AdView 
    android:id="@+id/ads" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    myapp:backgroundColor="#000000" 
    myapp:primaryTextColor="#FFFFFF" 
    myapp:secondaryTextColor="#CCCCCC" 
    myapp:refreshInterval="10" 
    android:visibility="visible" /> 
</LinearLayout> 
+0

ただ、 'myappの変更:' 'admobsdkに:' – nnhthuan

+0

は、私が何か間違ったことを見ていますか?コード内で「myapp」はどこですか? – Mich

+0

'xmlns:admobsdk =" http://schemas.android.com/apk/res/joke.content "' – nnhthuan

答えて

2

コンパイラが代わりにadmobsdk:を使用してくださいあなたのmyapp:

を理解していません。

コード例を参照してください:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:admobsdk="http://schemas.android.com/apk/res/joke.content" 
     android:orientation="vertical" android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <ImageView android:id="@+id/photo" android:src="@drawable/joker" 
       android:layout_width="wrap_content" android:layout_height="wrap_content" /> 
     <RelativeLayout android:layout_height="wrap_content" 
       android:layout_width="wrap_content"> 
       <TextView android:id="@+id/title" android:text="" 
         android:layout_width="wrap_content" android:layout_height="wrap_content" 
         android:textSize="24sp" android:textColor="@color/css_a" 
         android:layout_centerInParent="true" android:layout_alignParentTop="true"></TextView> 
     </RelativeLayout> 
     <ScrollView android:layout_width="fill_parent" 
       android:layout_height="wrap_content" android:layout_weight="1"> 
       <TextView android:layout_width="fill_parent" 
         android:layout_height="wrap_content" android:text="" android:id="@+id/content" 
         android:textSize="18sp" /> 
     </ScrollView> 

     <RelativeLayout android:layout_height="wrap_content" 
       android:layout_width="fill_parent"> 
       <Button android:text="下一篇" android:id="@+id/next" 
         android:layout_width="wrap_content" android:layout_height="wrap_content" 
         android:layout_alignParentRight="true" android:layout_marginRight="15dip" 
         android:textSize="22sp"></Button> 
     </RelativeLayout> 
     <com.admob.android.ads.AdView android:id="@+id/ad" 
       android:layout_width="fill_parent" admobsdk:backgroundColor="#000000" 
       admobsdk:textColor="#FFFFFF" admobsdk:refreshInterval="60" 
       admobsdk:keywords="笑话" android:layout_height="wrap_content" 
       admobsdk:testing="false" admobsdk:isGoneWithoutAd="false" /> 
</LinearLayout> 

前のコードでは、この行を持っていることを確認してください:

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

はあなたattrs.xmlをい(RESに/フォルダ値)のように見えるファイルこの:

<?xml version="1.0" encoding="utf-8" ?> 
    <resources> 
     <declare-styleable name="com.admob.android.ads.AdView"> 
     <attr name="backgroundColor" format="color" /> 
     <attr name="primaryTextColor" format="color" /> 
     <attr name="secondaryTextColor" format="color" /> 
     <attr name="keywords" format="string" /> 
     <attr name="refreshInterval" format="integer" /> 
     </declare-styleable> 
    </resources> 

ない場合、XMLファイル名を作成し、あなたのres /値のフォルダにattrs.xmlと私にこのコードをコピーt。

joke.contentはあなたのパッケージ名です。パッケージ名に変更してください。

+0

こんにちは、申し訳ありませんが、私はあなたが言っていることをかなり理解していません。 – Mich

+0

'myapp'または' admobsdk'はここにあります: 'xmlns:admobsdk =" http://schemas.android.com/apk/res/joke.content "' – nnhthuan

+1

joke.content means? –

関連する問題