[英]Appodeal Banner Ad Covers Screen Android/LibGDX
I'm trying to insert Appodeal banner adds into a LibGDX application but the banner ad is covering the screen instead of being placed above it.我正在尝试将 Appodeal 横幅添加到 LibGDX 应用程序中,但横幅广告覆盖了屏幕而不是放置在其上方。 I cannot find any tutorials for using Appodeal in LibGDX, so I'm working from this tutorial on using Admob in LibGDX.
我找不到在 LibGDX 中使用 Appodeal 的任何教程,所以我正在从本教程中使用 LibGDX 中的 Admob。 https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx
https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx
I cannot figure out how to get the Appodeal banner ad in the form of a View which can be added to the RelativeLayout using the addView() method.我无法弄清楚如何以 View 的形式获取 Appodeal 横幅广告,可以使用 addView() 方法将其添加到 RelativeLayout。 I have tried a couple ways to do this which are labeled “ATTEMPT #1” and “ATTEMPT #2” but in both attempts the banner ad does not display at all.
我尝试了几种方法来做到这一点,它们被标记为“ATTEMPT #1”和“ATTEMPT #2”,但在这两种尝试中,横幅广告都没有显示。 The line “Appodeal.show(this, BANNER);”
“Appodeal.show(this, BANNER);”这一行places the banner on top of the screen, so that is commented out.
将横幅放在屏幕顶部,因此被注释掉。 Any help getting this figure out would be greatly appreciated.
任何帮助得到这个数字将不胜感激。 Thanks.
谢谢。
Here is my AndroidLauncher.java file where I create and show the banner ad.这是我的 AndroidLauncher.java 文件,我在其中创建并显示横幅广告。
public class AndroidLauncher extends AndroidApplication {
private final int BANNER = 4;
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
// LAYOUT: combines LibGDX View and Ad View
RelativeLayout relativeLayout = new RelativeLayout(this);
// Ad View
Appodeal.initialize(this, "fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f", BANNER);
Appodeal.setTesting(true);
// Appodeal.show(this, BANNER);
// ATTEMPT #1
BannerView bannerView = Appodeal.getBannerView(this);
// ATTEMPT #2
// BannerView bannerView = new BannerView(this, null);
// Appodeal.setBannerViewId(bannerView.getId());
// LibGDX View
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
View libgdxView = initializeForView(new AppodealGDXDemo(), config);
// add to view
relativeLayout.addView(bannerView);
relativeLayout.addView(libgdxView);
// set layout
setContentView(relativeLayout);
}
}
I finally found info on the Appodeal website that helped me out.我终于在 Appodeal 网站上找到了帮助我的信息。 https://wiki.appodeal.com/en/android/2-5-8-android-sdk-integration-guide/ad-types It appears they have made a lot of changes to their website as the links to documentation on their website that I found from google redirected to the main page.
https://wiki.appodeal.com/en/android/2-5-8-android-sdk-integration-guide/ad-types看来他们已经对他们的网站进行了很多更改,因为他们的网站上的文档链接我从谷歌找到的网站重定向到主页。
I got it working now and here is the updated code.我现在开始工作了,这是更新的代码。
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
// LAYOUT: combines LibGDX View and Ad View
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
// Ad View
Appodeal.initialize(this, "fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f", Appodeal.BANNER_VIEW);
Appodeal.setTesting(true);
BannerView bannerView = Appodeal.getBannerView(this);
Appodeal.show(this, Appodeal.BANNER_VIEW);
// LibGDX View
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
View libgdxView = initializeForView(new AppodealGDXDemo(), config);
// add to layout
layout.addView(bannerView);
layout.addView(libgdxView);
// set layout
setContentView(layout);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.