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

    1. <small id='havFZ'></small><noframes id='havFZ'>

        我的 Admob 广告没有绘图,但有吗?(LibGDX Admob 6.4

        时间:2023-07-27
        <legend id='hy743'><style id='hy743'><dir id='hy743'><q id='hy743'></q></dir></style></legend>

          <bdo id='hy743'></bdo><ul id='hy743'></ul>
          • <small id='hy743'></small><noframes id='hy743'>

            <i id='hy743'><tr id='hy743'><dt id='hy743'><q id='hy743'><span id='hy743'><b id='hy743'><form id='hy743'><ins id='hy743'></ins><ul id='hy743'></ul><sub id='hy743'></sub></form><legend id='hy743'></legend><bdo id='hy743'><pre id='hy743'><center id='hy743'></center></pre></bdo></b><th id='hy743'></th></span></q></dt></tr></i><div id='hy743'><tfoot id='hy743'></tfoot><dl id='hy743'><fieldset id='hy743'></fieldset></dl></div>
            <tfoot id='hy743'></tfoot>
              <tbody id='hy743'></tbody>
                  本文介绍了我的 Admob 广告没有绘图,但有吗?(LibGDX Admob 6.4.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 LibGDX 0.9.9 和 Admob 6.4.1.我将横幅广告设置为显示在我的应用程序的右上角.但是,当我加载我的应用程序时,我看不到横幅.尽管当我按下横幅应该在的位置时,它的行为就像正常一样并开始出现.这在测试模式和实模式下都会发生.这是我的代码:

                  I am using LibGDX 0.9.9 and Admob 6.4.1. I set up banner ads to appear in the top right corner of my app. However when I load up my app I can't see the banner. Although when I press where the banner should be it acts like normal and starts to appear. This happens both in testing mode and real mode. Here is my code:

                      public class MainActivity extends AndroidApplication {
                      private AdView adView;
                  
                      @Override
                      public void onCreate(Bundle savedInstanceState) {
                          super.onCreate(savedInstanceState);
                  
                          AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
                          cfg.useGL20 = false;
                          cfg.useAccelerometer = false;
                          cfg.useCompass = false;
                  
                          RelativeLayout layout = new RelativeLayout(this);
                          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 Game(), false);
                  
                          // Create and setup the AdMob view
                          adView = new AdView(this);
                          adView.setAdUnitId("SECRET ID");
                          adView.setAdSize(AdSize.BANNER);
                  
                          AdRequest adRequest = new AdRequest.Builder()
                          .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)       // Emulator
                          .addTestDevice("MY DEVICE ID") // My  Nexus test
                          .build();
                  
                          adView.loadAd(adRequest);
                  
                          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_TOP);
                          adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
                  
                          layout.addView(adView, adParams);
                  
                          setContentView(layout);
                      }
                  
                      public void onDestroy() { 
                          if (adView != null) { 
                              adView.destroy();
                          }
                  
                          super.onDestroy();
                      }
                  

                  和 Android 清单:

                  and the Android Manifest:

                      <?xml version="1.0" encoding="utf-8"?>
                  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                      package="com.keep.hopping"
                      android:versionCode="1"
                      android:versionName="1.0" >
                  
                      <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
                  
                      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
                      <uses-permission android:name="android.permission.INTERNET"/>
                      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
                  
                      <application
                          android:icon="@drawable/jumper"
                          android:label="Keep Hopping" >
                          <meta-data android:name="com.google.android.gms.version"
                                 android:value="@integer/google_play_services_version"/>
                          <activity
                              android:name="com.keep.hopping.MainActivity"
                              android:label="Keep Hopping"
                              android:screenOrientation="landscape"
                              android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
                              <intent-filter>
                                  <action android:name="android.intent.action.MAIN" />
                                  <category android:name="android.intent.category.LAUNCHER" />
                              </intent-filter>
                          </activity>
                           <activity android:name="com.google.android.gms.ads.AdActivity"
                               android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
                      </application>
                  
                  </manifest>
                  

                  有人知道为什么会发生这种奇怪的行为吗?

                  Anyone have any ideas as to why this weird behaviour is happening?

                  推荐答案

                  在我的情况下,只需设置 adview 的背景即可解决问题:

                  In my case the problem was solved simply by setting the background of the adview:

                  ...
                  layout.addView(adView, adParams);
                  adView.setBackgroundColor(getResources().getColor(android.R.color.transparent));
                  ...
                  

                  你可以使用任何其他颜色.

                  you can use any other color.

                  这篇关于我的 Admob 广告没有绘图,但有吗?(LibGDX Admob 6.4.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:无法循环操作.库GDX 下一篇:安卓.如何沿它所面对的方向移动对象(使用 Vect

                  相关文章

                  最新文章

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

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

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