0
public class AGame extends Game{
@Override
public Screen getStartScreen() {
return new LoadingScreen(this);
}
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
RelativeLayout rl = new RelativeLayout(this);
RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
AdView adView = new AdView (this, AdSize.BANNER, "MY_ADMOB_ID");
rl.addView(adView, adParams);
AdRequest adRequest = new AdRequest();
adRequest.setTesting(true);
adView.loadAd(adRequest);
}
我嘗試這樣的代碼,但它並不顯示任何屏幕上的廣告。我粘貼在這裏的這段代碼是我的第一個活動,從這裏開始,它會進入新的屏幕。我想在我的所有活動中展示廣告。如果我放置一個setContentView(rl);排在我的adView.loadAd(adRequest)下方;它只顯示一個廣告和一個黑屏。我認爲我需要以這種行動實施我的廣告,因爲在其他廣告中,我無法使用onCreate方法。請幫幫我。感謝您的幫助!抱歉,我不是英語。
編輯:LogCat寫信給我,我收到廣告,我只能看不到它們。