layout新增main.xml
?xml version="1.0" encoding="utf-8"?>
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/mainLayout"
>
android:layout_height="wrap_content"
ads:adUnitId="a524a4c7ff0205"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
廣告在下
package com.phonegap.helloworld;
import android.os.Bundle;
import android.widget.LinearLayout;
import org.apache.cordova.*;
import com.google.ads.*;
public class HelloWorld extends CordovaActivity
{
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
adView = new AdView(this, AdSize.BANNER, "a524a4c7ff0205");
LinearLayout layout = super.root;
layout.addView(adView);
adView.loadAd(new AdRequest());
super.loadUrl(Config.getStartUrl());
}
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
}
廣告在上
package com.phonegap.helloworld;
import android.os.Bundle;
import android.widget.LinearLayout;
import org.apache.cordova.*;
import com.google.ads.*;
public class HelloWorld extends CordovaActivity
{
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
adView = new AdView(this, AdSize.BANNER, "a1524a4c7ff0205");
LinearLayout layout = super.root;
layout.addView(adView);
adView.loadAd(new AdRequest());
super.init();
super.loadUrl(Config.getStartUrl());
}
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
}
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。