libMDX表面上的AdMob - 标题消失

时间:2014-02-26 23:50:49

标签: android libgdx admob

当我使用title运行活动时,Admob正在显示常规的libGDX表面。 只要我用这个禁用活动标题:

requestWindowFeature(Window.FEATURE_NO_TITLE);

AdMob消失了。有人有想法,为什么请?

任何建议都会有所帮助。提前谢谢。

我的MainActivity中的代码

public class MainActivity extends AndroidApplication {
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGL20 = false;

    // requesting to turn the title OFF
    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    // making it full screen
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    /* Your ad unit id. Replace with your actual ad unit id. */
    final String AD_UNIT_ID = "00000000000000";

 // Create an ad.
    adView = new AdView(this);
    adView.setAdSize(AdSize.BANNER);
    adView.setAdUnitId(AD_UNIT_ID);

    RelativeLayout layout = new RelativeLayout(this);

    View gameView=initializeForView(new ZBGame(), cfg);

    RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);

    RelativeLayout.LayoutParams adParams1 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParams1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    adParams1.addRule(RelativeLayout.CENTER_HORIZONTAL); 

    AdRequest adRequest = new AdRequest.Builder().build();   
    adView.loadAd(adRequest);

    layout.addView(gameView, adParams);
    layout.addView(adView, adParams1);

    setContentView(layout);
    //requestWindowFeature(Window.FEATURE_NO_TITLE);
}
private View initializeForView(Object initialize) {
    // TODO Auto-generated method stub
    return null;
}

1 个答案:

答案 0 :(得分:0)

删除此:

private View initializeForView(Object initialize){
    // TODO Auto-generated method stub
    return null;
}