添加广告的时候学到的东西

 1. 添加外部包的时候必须在android加个libs文件夹,然后把jar放到这个文件里面,不在这个目录的话,android是不认的。

 2. android可以添加自定义属性。

     可以在values文件夹下面添加xml

<resources>

<declare-styleable name="cn.domob.android.ads.DomobAdView">
<attr name="backgroundColor" format="color" />
<attr name="primaryTextColor" format="color" />
<attr name="keywords" format="string" />
<attr name="spots" format="string" />
<attr name="refreshInterval" format="integer" />
</declare-styleable>

</resources>

这个就是定义属性

用的时候要在layout文件夹里面加上

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/foodxk.com"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/shade"
android:id="@+id/mainly1"
>

<cn.domob.android.ads.DomobAdView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
myapp:keywords="game"
myapp:spots="androidtest"
myapp:refreshInterval="20"
>
</cn.domob.android.ads.DomobAdView>

原文地址:https://www.cnblogs.com/shenbin/p/2454224.html