java - Inmobi 横幅广告尺寸

标签 java android inmobi

我正在尝试以编程方式将 Inmobi 横幅广告集成到我的应用程序中,但我在横幅广告的大小方面遇到了问题。我的 Launcher 类中有以下代码 fragment :

RelativeLayout.LayoutParams bannerLp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        bannerLp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        bannerLp.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
        layout.addView(bannerAd, bannerLp);
        setContentView(layout);
        bannerAd.load();

手机上不会显示任何广告。但是当我将高度参数从 WRAP_CONTENT 设置为 80 时。它完全适合底部。但当在更大屏幕尺寸的手机上尝试相同时,它显得很小。 我对 AdMob 广告使用了相同的代码 fragment ,但没有遇到这个困难。我总是将 with 参数设置为 MATCH_PARENT,将 height 参数设置为 WRAP_CONTENT。为什么使用Inmobi时不显示任何内容?

最佳答案

根据 InMobi 集成 guide :

You should specify the banner view dimensions in pixel units when setting the layout parameters for the banner ad. Also, it is a programming error to supply WRAP_CONTENT as the layout parameters for a banner ad. This constraint applies whether you create a banner in your XML layout resource file or in code.

关于java - Inmobi 横幅广告尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44431086/

相关文章:

android - InMobi 广告不显示在 Android 上?

java - 在 Android 中将 2015-02-24 转换为一天?

java - 向 JScrollBar 添加滚动锁定按钮

java - 返回码是 : 409, ReasonPhrase:Conflict (JCenter)

intel-xdk - 英特尔 XDK 的 Inmobi 广告集成示例?

Java/JSP 库将复合对象呈现为 HTML?

java - 在 Try/Catch 中初始化

android - 错误:(246,5)错误:使用配置 'attr/rippleColor'复制资源 ''的值

android - 如何在 flutter 中设置滚动条颜色?