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


Java AdSize.BANNER属性代码示例

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


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

示例1: adSizeFromSize

/**
 * Gets an AdSize object from the string size passed in from JavaScript.
 * Returns null if an improper string is provided.
 *
 * @param size The string size representing an ad format constant.
 * @return An AdSize object used to create a banner.
 */
public static AdSize adSizeFromSize(String size) {
  if ("BANNER".equals(size)) {
    return AdSize.BANNER;
  } else if ("IAB_MRECT".equals(size)) {
    return AdSize.IAB_MRECT;
  } else if ("IAB_BANNER".equals(size)) {
    return AdSize.IAB_BANNER;
  } else if ("IAB_LEADERBOARD".equals(size)) {
    return AdSize.IAB_LEADERBOARD;
  } else if ("SMART_BANNER".equals(size)) {
    return AdSize.SMART_BANNER;
  } else {
    return null;
  }
}
 
开发者ID:psydrake,项目名称:litecoinEasyCheck,代码行数:22,代码来源:AdMob.java

示例2: adSizeFromSize

/**
 * Gets an AdSize object from the string size passed in from JavaScript.
 * Returns null if an improper string is provided.
 * 
 * @param size
 *            The string size representing an ad format constant.
 * @return An AdSize object used to create a banner.
 */
public static AdSize adSizeFromSize(String size) {
	if ("BANNER".equals(size)) {
		return AdSize.BANNER;
	} else if ("IAB_MRECT".equals(size)) {
		return AdSize.IAB_MRECT;
	} else if ("IAB_BANNER".equals(size)) {
		return AdSize.IAB_BANNER;
	} else if ("IAB_LEADERBOARD".equals(size)) {
		return AdSize.IAB_LEADERBOARD;
	} else if ("SMART_BANNER".equals(size)) {
		return AdSize.SMART_BANNER;
	} else {
		return null;
	}
}
 
开发者ID:rafinskipg,项目名称:BombTouch,代码行数:23,代码来源:AdMobPlugin.java

示例3: addAdsTo

public void addAdsTo(ViewGroup container) {
    this.mContainer =container;
    mContainer.setVisibility(View.VISIBLE);
    View v = mContainer.findViewById(R.id.ad_banner);
    if(v==null) {

        AdView ad = new AdView(mContext,AdSize.BANNER, mAdUnitId);
        ad.setId(R.id.ad_banner);

        container.removeAllViews();
        ad.setAdListener(this);
        AdRequest request = new AdRequest();
        if(mTestDevices!=null)
            request.setTestDevices(mTestDevices);
        request.addTestDevice(AdRequest.TEST_EMULATOR);
        ad.loadAd(request);
        container.addView(ad);
    }

}
 
开发者ID:MagicMicky,项目名称:FreemiumLibrary,代码行数:20,代码来源:AdsInstantiator.java

示例4: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.pause_layout, container);
    LinearLayout adLayout = (LinearLayout) view.findViewById(R.id.adLayout);

    adView = new AdView(activity, AdSize.BANNER, AdSettings.ADSENSE_ID);
    DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
    int width = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, AdSize.BANNER.getWidth(), displayMetrics));
    int height = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, AdSize.BANNER.getHeight(), displayMetrics));
    adLayout.addView(adView, width, height);
    AdRequest adRequest = new AdRequest();
    adRequest.addTestDevice(AdSettings.TEST_DEVICE_ID);
    adView.loadAd(adRequest);

    getDialog().setTitle(R.string.pause_title);

    Button pauseList = (Button) view.findViewById(R.id.pause_button_list);
    Button pauseRestart = (Button) view.findViewById(R.id.pause_button_restart);
    Button pauseContinue = (Button) view.findViewById(R.id.pause_button_continue);

    pauseContinue.setOnClickListener(new OnContinueClickListener());
    pauseList.setOnClickListener(new OnLevelListClickListener());
    pauseRestart.setOnClickListener(new OnRestartClickListener());

    return view;
}
 
开发者ID:tschut,项目名称:drturbo,代码行数:26,代码来源:PauseMenuFragment.java

示例5: addAD

/**
 * AdViewを挿入
 */
private void addAD() {
    // for adView
    //
    adView = new AdView(this, AdSize.BANNER, Conf.MY_AD_UNIT_ID);

    LinearLayout layout = (LinearLayout) findViewById(R.id.admobspace);

    // adView処理 --- ここから
    layout.addView(adView);

    // 広告の読み込み
    AdRequest adRequest = new AdRequest();
    if (BuildConfig.DEBUG) {
        // ここから - できればリリース時にコメントアウト
        // エミュレータ
        adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
        // Android端末をテスト
        // "XXXXXX...XX"には、端末の識別IDを指定(指定したIDの端末には広告は表示されない)
        adRequest.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
        // ここまで
    }
    adView.loadAd(adRequest);
    // adView処理 --- ここまで

}
 
开发者ID:Kyakujin,项目名称:AutoEco,代码行数:28,代码来源:MainActivity.java

示例6: onCreate

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    
    RelativeLayout layout = new RelativeLayout(this);
    adView = new AdView(this, AdSize.BANNER, AdMob_Ad_Unit); // Put in your secret key here
    
    View gameView = initializeForView(new AmpelBird(this), cfg);
    
    AdRequest adRequest = new AdRequest();
    adView.loadAd(adRequest);
    
    // Add the libgdx view
    layout.addView(gameView);

    // Add the AdMob view
    RelativeLayout.LayoutParams adParams = 
            new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
                            RelativeLayout.LayoutParams.WRAP_CONTENT);
    
    adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    adParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    
    layout.addView(adView, adParams);
    
    setContentView(layout);
}
 
开发者ID:onatm,项目名称:Ampel-Bird,代码行数:29,代码来源:MainActivity.java

示例7: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    adView = new AdView(this, AdSize.BANNER, "a14defa59f9a1e7");
    FrameLayout layout = (FrameLayout)findViewById(R.id.frameLayout);
    layout.addView(adView);
    adView.loadAd(new AdRequest());
    setAdView(adView);
}
 
开发者ID:Ruenzuo,项目名称:android-cd-travis-example,代码行数:9,代码来源:CitiesActivity.java

示例8: onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.end_level_layout, container);

    LinearLayout adLayout = (LinearLayout) view.findViewById(R.id.adLayout);

    adView = new AdView(activity, AdSize.BANNER, AdSettings.ADSENSE_ID);
    DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics();
    int width = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, AdSize.BANNER.getWidth(), displayMetrics));
    int height = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, AdSize.BANNER.getHeight(), displayMetrics));
    adLayout.addView(adView, width, height);
    AdRequest adRequest = new AdRequest();
    adRequest.addTestDevice(AdSettings.TEST_DEVICE_ID);
    adView.loadAd(adRequest);

    getDialog().setTitle(titleResource);
    ((TextView) view.findViewById(R.id.end_level_subtitle)).setText(textResource);
    ((ImageView) view.findViewById(R.id.end_level_star)).setImageResource(imageResource);
    ((TextView) view.findViewById(R.id.end_level_points)).setText(Integer.toString(points));
    ((TextView) view.findViewById(R.id.end_level_points_best)).setText(Integer.toString(best));

    Button next = (Button) view.findViewById(R.id.end_level_button_next);
    Button list = (Button) view.findViewById(R.id.end_level_button_list);
    Button retry = (Button) view.findViewById(R.id.end_level_button_retry);

    next.setEnabled(nextLevelUnlocked);

    next.setOnClickListener(new OnNextLevelClickListener());
    list.setOnClickListener(new OnLevelListClickListener());
    retry.setOnClickListener(new OnRetryClickListener());

    return view;
}
 
开发者ID:tschut,项目名称:drturbo,代码行数:33,代码来源:EndLevelDialogFragment.java

示例9: placeADMobAd

public static void placeADMobAd(ViewGroup viewGroup, LayoutParams params) {
	AdView adView = new AdView(activity, AdSize.BANNER, "c89f8c998cb3499c");
	AdRequest adRequest = new AdRequest();
	if (params == null)
		viewGroup.addView(adView);
	else
		viewGroup.addView(adView, params);
	adView.loadAd(adRequest);
}
 
开发者ID:jlaws,项目名称:gundog-engine,代码行数:9,代码来源:ADS.java

示例10: getAds

private View getAds() {
	AdView adView = new AdView(this, AdSize.BANNER, "a14d8380b359657");
	adView.loadAd(new AdRequest());
	
	return adView;
}
 
开发者ID:lebesnec,项目名称:Poker-Director,代码行数:6,代码来源:TemplatesListActivity.java

示例11: onCreateView

@Override
protected View onCreateView(ViewGroup parent) {
	// this will create the linear layout defined in ads_layout.xml
	View view = super.onCreateView(parent);

	// the context is a PreferenceActivity
	Activity activity = (Activity) getContext();

	// Create the adView
	AdView adView = new AdView(activity, AdSize.BANNER, "ca-app-pub-4450409123751393/6414798463");

	((LinearLayout) view).addView(adView);

	// Load the adView with the ad request
	adView.loadAd(new AdRequest());


	return view;
}
 
开发者ID:spirosbond,项目名称:CallerFlashlight,代码行数:19,代码来源:AdPreference.java

示例12: onCreateView

@Override
protected View onCreateView(ViewGroup parent) {
	// this will create the linear layout defined in ads_layout.xml
	View view = super.onCreateView(parent);

	// the context is a PreferenceActivity
	Activity activity = (Activity) getContext();

	// Create the adView
	AdView adView = new AdView(activity, AdSize.BANNER, "ca-app-pub-4450409123751393/8391059261");

	((LinearLayout) view).addView(adView);

	// Load the adView with the ad request
	adView.loadAd(new AdRequest());


	return view;
}
 
开发者ID:spirosbond,项目名称:CallerFlashlight,代码行数:19,代码来源:AdPreference2.java


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