English 中文(简体)
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...

最佳回答

Might be worth checking that the error isn t due to something outside the file:

Make sure the package name you are using in your schema URI, "org.ifies.android", matches the value of the package attribute on the manifest element in AndroidManifest.xml.

Make sure res/values/attrs.xml has the attributes specified:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="com.admob.android.ads.AdView">
        <attr name="testing" format="boolean" />
        <attr name="backgroundColor" format="color" />
        <attr name="textColor" format="color" />
        <attr name="keywords" format="string" />
        <attr name="refreshInterval" format="integer" />
        <attr name="isGoneWithoutAd" format="boolean" />
    </declare-styleable>
</resources>
问题回答

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)





相关问题
Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Best browser for testing under Safari Mobile on Linux?

I have an iPhone web app I m producing on a Linux machine. What s the best browser I can use to most closely mimic the feature-limited version of Safari present on the iPhone? (It s a "slimmed down" ...

Code Coverage Tools & Visual Studio 2008 Pro

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed ...

Is there any error checking web app cralwers out there?

Wondering if there was some sort of crawler we could use to test and re-test everything when changes are made to the web app so we know some new change didn t error out any existing pages. Or maybe a ...

热门标签