當前位置: 首頁>>代碼示例>>Java>>正文


Java AdView.setBackgroundColor方法代碼示例

本文整理匯總了Java中com.google.android.gms.ads.AdView.setBackgroundColor方法的典型用法代碼示例。如果您正苦於以下問題:Java AdView.setBackgroundColor方法的具體用法?Java AdView.setBackgroundColor怎麽用?Java AdView.setBackgroundColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.ads.AdView的用法示例。


在下文中一共展示了AdView.setBackgroundColor方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: initAdvertise

import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
private void initAdvertise() {
    AdView mAdView = new AdView(this);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    mAdView.setAdUnitId("ca-app-pub-3406938862137540/3927782716");
    mAdView.setBackgroundColor(Color.BLACK);
    AdRequest adRequest = new AdRequest.Builder().build();
    double dppxl = (1 * (Resources.getSystem().getDisplayMetrics().densityDpi / 160f));
    int v = this.getResources().getDisplayMetrics().heightPixels;
    RelativeLayout layout = (RelativeLayout) findViewById(R.id.act_main_baseLayout);
    layout.addView(mAdView, params);
    if(v/dppxl > 720)
        mAdView.setAdSize(AdSize.BANNER);
    else
      mAdView.setAdSize(AdSize.SMART_BANNER);
    mAdView.loadAd(adRequest);
}
 
開發者ID:inffeldgroup,項目名稱:sw2016,代碼行數:18,代碼來源:MainActivity.java

示例3: 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

示例4: setupAds

import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
public void setupAds() {
	adView = new AdView(this);
	adView.setVisibility(View.VISIBLE);
	adView.setBackgroundColor(0xff000000); //d7d7d7
	adView.setAdUnitId(AD_UNIT_ID_BANNER);
	adView.setAdSize(AdSize.SMART_BANNER);
}
 
開發者ID:SamukiPL,項目名稱:cykacommander,代碼行數:8,代碼來源: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(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

示例6: 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

示例7: 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

示例8: onCreate

import com.google.android.gms.ads.AdView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String mode = null;
    if(getIntent().getExtras() != null)
        mode = getIntent().getExtras().getString("mode");

    if (Build.VERSION.SDK_INT < 16)
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES | GameHelper.CLIENT_SNAPSHOT);
    gameHelper.setup(this);
    helper = new BackupAgentHelper();
    //gameHelper.setConnectOnStart(true);

    final AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.useAccelerometer = true;
    config.useWakelock = true;
    config.useImmersiveMode = false;
    config.useGyroscope = true;
    //initialize(new TDGalaxy(this, null, this), config);
    View view = initializeForView(new TDGalaxy(mode,this, null, this, this), config);
    RelativeLayout layout = new RelativeLayout(this);
    MobileAds.initialize(this, Constants.ADSENSE_ID);

    banner = new AdView(this);
    banner.setAdSize(AdSize.SMART_BANNER);
    banner.setAdUnitId(Constants.AD_BANNER);
    banner.setBackgroundColor(Color.BLACK);

    rewardVideo = MobileAds.getRewardedVideoAdInstance(this);
    rewardVideo.setRewardedVideoAdListener(this);
    rewardVideo.loadAd(Constants.AD_VIDEO, new AdRequest.Builder().build());

    RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    adParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layout.addView(view);
    layout.addView(banner, adParams);
    setContentView(layout);
    banner.setVisibility(View.VISIBLE);
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:43,代碼來源:AndroidLauncher.java


注:本文中的com.google.android.gms.ads.AdView.setBackgroundColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。