当前位置: 首页>>代码示例>>Java>>正文


Java AdView.setId方法代码示例

本文整理汇总了Java中com.google.android.gms.ads.AdView.setId方法的典型用法代码示例。如果您正苦于以下问题:Java AdView.setId方法的具体用法?Java AdView.setId怎么用?Java AdView.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.ads.AdView的用法示例。


在下文中一共展示了AdView.setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAdView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
private AdView createAdView() {
    mAdView = new AdView(this);
    mAdView.setAdSize(AdSize.LARGE_BANNER);

    // setup "testing" banner type
    boolean isStoreBuild = BuildConfig.FLAVOR.equals("playstore") && BuildConfig.BUILD_TYPE.equals("release");
    String adUnitId = isStoreBuild ? AD_UNIT_ID : "ca-app-pub-3940256099942544/6300978111";

    mAdView.setAdUnitId(adUnitId);
    mAdView.setId(View.generateViewId()); // this is an arbitrary id, allows for relative positioning in createGameView()
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    mAdView.setLayoutParams(params);
    mAdView.setBackgroundColor(Color.BLACK);

    return mAdView;
}
 
开发者ID:tgobbens,项目名称:fluffybalance,代码行数:20,代码来源:AndroidLauncher.java

示例2: createAdView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
private void createAdView() {
    adView = new AdView(this);
    adView.setAdSize(AdSize.SMART_BANNER);
    adView.setAdUnitId(AD_UNIT_ID);
    adView.setId(R.id.adsMobId); // this is an arbitrary id, allows for relative positioning in createGameView()
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    adView.setLayoutParams(params);
    adView.setBackgroundColor(Color.BLACK);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:12,代码来源:AndroidLauncher.java

示例3: createAdView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
private AdView createAdView() {
  adView = new AdView(this);
  adView.setAdSize(AdSize.SMART_BANNER);
  adView.setAdUnitId(AD_UNIT_ID);
  adView.setId(12345); // this is an arbitrary id, allows for relative positioning in createGameView()
  RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
  params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
  adView.setLayoutParams(params);
  adView.setBackgroundColor(Color.BLACK);
  return adView;
}
 
开发者ID:Jocke101,项目名称:MathMemory,代码行数:13,代码来源:AndroidLauncher.java

示例4: createAdView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
private AdView createAdView() {
    AdView adView = new AdView(this);
    adView.setAdSize(AdSize.SMART_BANNER);
    adView.setAdUnitId(getString(R.string.ad_banner1));
    adView.setId(12345);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    adView.setLayoutParams(params);
    adView.setBackgroundColor(Color.BLACK);
    return adView;
}
 
开发者ID:mcprog,项目名称:ragnar,代码行数:13,代码来源:AndroidLauncher.java

示例5: createAdView

import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
private AdView createAdView() {
	adView = new AdView(this);
       adView.setAdSize(AdSize.SMART_BANNER);
       adView.setAdUnitId(SMALL_CODE);
       adView.setId(12345); // this is an arbitrary id, allows for relative positioning in createGameView()
       RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
       params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
       params.addRule(RelativeLayout.CENTER_HORIZONTAL);
       layout.setLayoutParams(params);
       adView.setLayoutParams(params);
       adView.setBackgroundColor(Color.TRANSPARENT);
       return adView;
}
 
开发者ID:costular,项目名称:crabox,代码行数:14,代码来源:AndroidLauncher.java


注:本文中的com.google.android.gms.ads.AdView.setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。