Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
726 views
in Technique[技术] by (71.8m points)

testing - What is correct xmlns url for AdMob in Android Layout XML

I am testing the AdMob for Android SDK. I can't set the admob:testing="true" because the admob attribute is unknown.

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:admob="http://schemas.android.com/apk/res/org.ifies.android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  android:background="#FF000000"
  android:clickable="true"
>
  <com.admob.android.ads.AdView  
    android:id="@+id/admob" 
    android:visibility="visible"
    android:layout_width="fill_parent" 
    android:layout_height="100px"
    android:background="#FF0000"
    admob:testing="true"
  />
</LinearLayout>

My Eclipse is complaining that admob:testing="true" would have an unknown prefix. Anyone got an idea on how to fix this?

Sub question: Anyone got an idea how to change the height of the ad? It seems to be fixed to 48px, which is not looking good on any DROID phone...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This took me a while to figure out, so I am posting it here:

Since AdMob 4.1 this has changed, so the previous answer is correct for versions <=4.04. Now you need to use:

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 

No place for your own package in the new schema and no need for an attrs.xml file.

Details here: http://groups.google.com/group/google-admob-ads-sdk/browse_thread/thread/3b885d3fe5bb21a5?pli=1 (Tim's post, it's the 8th from the top)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...