• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

AdMob over libGDX表面 – 与标题一起消失

Android 来源:Jalle 4次浏览

当我使用标题运行活动时,Admob会显示regulary iver libGDX表面。 当我关闭这个活动名称:AdMob over 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; 
} 

===========解决方案如下:

删除此:

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

版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)