本文整理汇总了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;
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
示例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処理 --- ここまで
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例10: getAds
private View getAds() {
AdView adView = new AdView(this, AdSize.BANNER, "a14d8380b359657");
adView.loadAd(new AdRequest());
return adView;
}
示例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;
}
示例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;
}