智能横幅加载适应全屏尺寸

时间:2019-05-24 11:12:16

标签: android admob adbannerview candisplaybannerads

智能横幅广告加载以适应全屏尺寸 广告正在加载以下图片enter image description here

public static void adds_offline(Context context, final LinearLayout layout) {
    AdView adView = new AdView(context);
    adView.setAdUnitId("ca-app-pub-4267540560263635/4160942451");
    adView.setAdSize(AdSize.SMART_BANNER);

    layout.addView(adView);
    adView.setAdListener(new AdListener() {
      @Override
      public void onAdLoaded() {
        layout.setVisibility(View.VISIBLE);
      }
    });
    AdRequest request = new AdRequest.Builder().build();
    adView.loadAd(request);
  }

0 个答案:

没有答案