【问题标题】:DoubleClick - Interstitial advertise sizing/cropping/center placing -> Impossible?DoubleClick - 插页式广告尺寸/裁剪/居中放置 -> 不可能?
【发布时间】:2013-05-01 10:43:46
【问题描述】:

遵循此代码 (https://developers.google.com/mobile-ads-sdk/docs/admob/advanced):

import com.google.ads.*;

public class BannerExample extends Activity implements AdListener {

  private InterstitialAd interstitial;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Create the interstitial
    interstitial = new InterstitialAd(this, MY_INTERSTITIAL_UNIT_ID);

    // Create ad request
    AdRequest adRequest = new AdRequest();

    // Begin loading your interstitial
    interstitial.loadAd(adRequest);

    // Set Ad Listener to use the callbacks below
    interstitial.setAdListener(this);
  }

  @Override
  public void onReceiveAd(Ad ad) {
    Log.d("OK", "Received ad");
    if (ad == interstitial) {
      interstitial.show();
    }
  }
}

我的图片(我的广告)比我的手机屏幕还小。 我想知道是否可以将创建的视图调整为 java 代码的大小。 (在onCreate()onReceiveAd() 中)用于调整广告的大小。

LayoutParam,以 CenterCrop 为例,或者简单地调整视图的大小!

【问题讨论】:

    标签: android admob ads double-click interstitial


    【解决方案1】:

    如果您想从 DFP 向手机投放插页式广告,您可以在 DFP 中设置图片,并将尺寸替换为 320x480。然后可以投放该广告素材,并且可以根据需要变小。

    或者,您可能正在寻找横幅而不是占据整个屏幕的插页式叠加层。在这种情况下,您可以为您的 AdView specify a custom size,它应该与您在 DFP 中设置的尺寸相匹配。

    【讨论】:

    • 我也环顾四周,确实找到了将正确尺寸的广告素材放入屏幕的解决方案。我的屏幕是 1080 像素 x 1920 像素。实际显示偏离主屏幕。
    猜你喜欢
    • 1970-01-01
    • 2023-04-01
    • 2016-07-07
    • 2012-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多