如何在AndEngine中实现广告

时间:2014-07-16 12:18:11

标签: android andengine

我正在尝试使用AndEngine中的startApp显示广告。

像这样,

@Override
protected void onSetContentView() 
{
    StartAppAd.init(this, "apiID", "appID");            

    RelativeLayout relativeLayout = new RelativeLayout(this);
    RelativeLayout.LayoutParams layoutParams1 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);

    BannerStandard startAppBanner = new BannerStandard(this);

    relativeLayout.addView(startAppBanner, layoutParams);


    this.addContentView(relativeLayout, layoutParams1); 
}

但它不起作用,请帮帮我。我几乎完成了其他设置,比如添加jar和manifest文件。

0 个答案:

没有答案