<i id='e3jAZ'><tr id='e3jAZ'><dt id='e3jAZ'><q id='e3jAZ'><span id='e3jAZ'><b id='e3jAZ'><form id='e3jAZ'><ins id='e3jAZ'></ins><ul id='e3jAZ'></ul><sub id='e3jAZ'></sub></form><legend id='e3jAZ'></legend><bdo id='e3jAZ'><pre id='e3jAZ'><center id='e3jAZ'></center></pre></bdo></b><th id='e3jAZ'></th></span></q></dt></tr></i><div id='e3jAZ'><tfoot id='e3jAZ'></tfoot><dl id='e3jAZ'><fieldset id='e3jAZ'></fieldset></dl></div>

    <bdo id='e3jAZ'></bdo><ul id='e3jAZ'></ul>

        <small id='e3jAZ'></small><noframes id='e3jAZ'>

        <legend id='e3jAZ'><style id='e3jAZ'><dir id='e3jAZ'><q id='e3jAZ'></q></dir></style></legend>
      1. <tfoot id='e3jAZ'></tfoot>

      2. 在游戏视图下添加 admob

        时间:2023-07-28

            <bdo id='dR64o'></bdo><ul id='dR64o'></ul>

            • <i id='dR64o'><tr id='dR64o'><dt id='dR64o'><q id='dR64o'><span id='dR64o'><b id='dR64o'><form id='dR64o'><ins id='dR64o'></ins><ul id='dR64o'></ul><sub id='dR64o'></sub></form><legend id='dR64o'></legend><bdo id='dR64o'><pre id='dR64o'><center id='dR64o'></center></pre></bdo></b><th id='dR64o'></th></span></q></dt></tr></i><div id='dR64o'><tfoot id='dR64o'></tfoot><dl id='dR64o'><fieldset id='dR64o'></fieldset></dl></div>
                <tbody id='dR64o'></tbody>
                <legend id='dR64o'><style id='dR64o'><dir id='dR64o'><q id='dR64o'></q></dir></style></legend>

                <small id='dR64o'></small><noframes id='dR64o'>

                1. <tfoot id='dR64o'></tfoot>
                2. 本文介绍了在游戏视图下添加 admob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我一直在尝试将 admob 放在我的游戏视图下方.

                  I have been trying to put admob underneath my game view.

                  这是我的代码

                  public class HoodStarGame extends AndroidApplication {
                  @Override public void onCreate (Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      // Create the layout
                      RelativeLayout layout = new RelativeLayout(this);
                  
                      // Do the stuff that initialize() would do for you
                      requestWindowFeature(Window.FEATURE_NO_TITLE);
                      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                      WindowManager.LayoutParams.FLAG_FULLSCREEN);
                      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
                  
                      // Create the libgdx View
                      View gameView = initializeForView(new HoodStar(), false);
                  
                      // Create and setup the AdMob view
                      AdRequest request = new AdRequest();
                      request.addTestDevice(AdRequest.TEST_EMULATOR);
                      request.addTestDevice("7ADDEC88A42947CD1FD7F2EC2F527485");
                  
                      AdView adView = new AdView(this, AdSize.BANNER, "a14f19c2fe8d9e0"); // Put in your secret key here
                      adView.loadAd(request);
                  
                      // Add the libgdx view
                      layout.addView(gameView);
                  
                      // Add the AdMob view
                      RelativeLayout.LayoutParams adParams = 
                              new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
                                              RelativeLayout.LayoutParams.WRAP_CONTENT);
                      adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
                  
                      layout.addView(adView, adParams);
                  
                      // Hook it all up
                      setContentView(layout);
                  }
                  

                  }

                  但是,当运行此程序时,广告会显示在底部的游戏屏幕顶部

                  However when run this the ads show on top of the game screen at the bottom

                  我该如何解决这个问题?

                  how can i sort this out?

                  推荐答案

                  you are missing trueadParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);

                  you are missing true adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);

                  您很可能想要为 gameLayoutParams 设置边距:

                  most likely you will want to set a margin for the gameLayoutParams:

                  gameLayoutParams.bottomMargin = 55;//不管高度是多少

                  gameLayoutParams.bottomMargin = 55;// whatever the height is

                  这篇关于在游戏视图下添加 admob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在非 GUI 服务器环境中运行 libGDX 应用程序 下一篇:Libgdx、物理、加速和 FPS

                  相关文章

                  最新文章

                3. <i id='UX7A1'><tr id='UX7A1'><dt id='UX7A1'><q id='UX7A1'><span id='UX7A1'><b id='UX7A1'><form id='UX7A1'><ins id='UX7A1'></ins><ul id='UX7A1'></ul><sub id='UX7A1'></sub></form><legend id='UX7A1'></legend><bdo id='UX7A1'><pre id='UX7A1'><center id='UX7A1'></center></pre></bdo></b><th id='UX7A1'></th></span></q></dt></tr></i><div id='UX7A1'><tfoot id='UX7A1'></tfoot><dl id='UX7A1'><fieldset id='UX7A1'></fieldset></dl></div>
                  <tfoot id='UX7A1'></tfoot>
                4. <small id='UX7A1'></small><noframes id='UX7A1'>

                    <bdo id='UX7A1'></bdo><ul id='UX7A1'></ul>
                  <legend id='UX7A1'><style id='UX7A1'><dir id='UX7A1'><q id='UX7A1'></q></dir></style></legend>