java - 如何在回收站 View 中隐藏广告 View

标签 java android admob android-recyclerview

我已在我的回收站 View 中实现了 Admob Native Express 广告。如果没有可用的互联网,它会在列表中保留空白,直到广告加载为止。如何隐藏该空白区域直到广告加载? 谢谢

最佳答案

只需实现 AdListener监听 onAdLoaded 事件。

The onAdLoaded method is executed when an ad has finished loading. If you want to delay adding the AdView to your activity or fragment until you're sure an ad will be loaded, for example, you can do so here. If you're using a third-party analytics package to track impressions, this is also where you can place the call to record one.

Source

mAdView.setAdListener(new AdListener() {
    @Override
    public void onAdLoaded() {
        // HERE!!!!!!
    }
});

注意没有必要override all methods

AdListener provides a default empty implementation for all of its ad lifecycle events. You only need to override the ad events you wish to implement.

关于java - 如何在回收站 View 中隐藏广告 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38068364/

相关文章:

java int字段让空

Android - 检测 Activity 是否因屏幕方向改变而启动

android - 将 admob 广告放在 webview 的底部

java - Java中的方法重载

java - IllegalStateException textview 在 Kotlin 中不能为 null

android - 如何通过utf-8编码从服务中解析XML特殊字符

java - 当我为 Lint 实现自定义检测器时如何调试 java 源代码?

android - ARC Welder/ChromeOS 上的广告

ios - 每当 admob 收到广告时,cocos2dx 动画就会滞后

java - 编译时间与运行时间依赖关系 - Java