本文整理汇总了Java中com.google.ads.AdView类的典型用法代码示例。如果您正苦于以下问题:Java AdView类的具体用法?Java AdView怎么用?Java AdView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AdView类属于com.google.ads包,在下文中一共展示了AdView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.photo_layout, container, false);
mCloseAdView = rootView.findViewById(R.id.title);
mCloseAdView.setOnClickListener(this);
// TextView des = (TextView) rootView.findViewById(R.id.des);
// des.setText(mDes);
mAdView = (AdView) rootView.findViewById(R.id.adView);
mAdView.setAdListener(this);
NetworkPhotoView photoView = (NetworkPhotoView) rootView.findViewById(R.id.photo);
photoView.setOnSetImageBitmap(this);
photoView.setErrorImageResId(R.drawable.ic_error);
photoView.setDefaultImageResId(R.drawable.ic_default);
photoView.setImageUrl(mUrl, App.getImageLoader());
mPhotoView = photoView;
return rootView;
}
示例2: onCreateView
import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(
R.layout.fragment_number_practice_dummy, container, false);
canvas = (CanvasTextView) rootView
.findViewById(R.id.numberPracticeCanvas);
canvas.setText(getArguments().getString(ARG_LETTER));
AdView adView = (AdView) rootView.findViewById(R.id.ad);
if (adView != null) {
adView.loadAd(new AdRequest());
}
return rootView;
}
示例3: onCreateView
import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater,
final ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_word_canvas_dummy,
container, false);
wordLetters1 = (TextView) rootView
.findViewById(R.id.wordLettersCanvas);
wordLetters2 = (TextView) rootView
.findViewById(R.id.pronounciationCanvas);
letterItemsInWords = LettersInWordItem.EXAMPLE_WORDS_LETTERS
.get(getArguments().getString(ARG_FARSI_WORD));
if (letterItemsInWords != null && wordLetters1 != null) {
wordLetters1.setText(createText(letterItemsInWords));
}
wordCanvas = (CanvasTextView) rootView
.findViewById(R.id.wordCanvas);
wordCanvas.setText(getArguments().getString(ARG_FARSI_WORD));
AdView adView = (AdView) rootView.findViewById(R.id.ad);
if (adView != null) {
adView.loadAd(new AdRequest());
}
return rootView;
}
示例4: onCreate
import com.google.ads.AdView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.general_config);
addPreferencesFromResource(R.xml.general_config);
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mOpacity = Constants.DEFAULT_OPACITY; //default
// mBackgroundColor = Constants.DEFAULT_BACKGROUND_COLOR;
mShortcutIconSize = mShortcutDefaultIconSzie = getResources().getDimensionPixelSize(Constants.DEFAULT_SHORTCUT_ICON_SIZE_ID);
try {
mPackageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
} catch (NameNotFoundException e) {
LogUtils.w(TAG, e.getMessage(), e);
}
findPreference();
mAdView = (AdView) findViewById(R.id.adView);
AdRequest request = new AdRequest();
// request.addTestDevice("56D63A77B274B556D00C3D6C4191560C");
// request.addTestDevice("19C036F0231C3870BF96D723B76E7215");
mAdView.loadAd(request);
}
示例5: onCreate
import com.google.ads.AdView; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_listview);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
lv = (ListView) findViewById(R.id.listView);
emptyView = View.inflate(BaseListActivity.this, R.layout.empty_list,
null);
adView = (AdView) findViewById(R.id.adView);
adLayout = findViewById(R.id.zzz);
addContentView(emptyView, new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
((ImageView) emptyView.findViewById(R.id.imageView1)).setAlpha(0x33);
lv.setEmptyView(emptyView);
lv.setOnItemClickListener(this);
init();
loadAd();
}
示例6: onCreate
import com.google.ads.AdView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
AdView adView = (AdView) this.findViewById(R.id.add);
AdRequest adRequest = new AdRequest();
adView.loadAd(adRequest);
} catch (Exception e) {
e.printStackTrace();
}
if (CallerFlashlight.LOG) Log.d(TAG, "onCreated");
setContentView(R.layout.first_time);
callerFlashlight = (CallerFlashlight) getApplication();
Button testButton = (Button) findViewById(R.id.firstFlashTest);
testButton.setOnClickListener(this);
contButton = (Button) findViewById(R.id.firstcontinue);
contButton.setOnClickListener(this);
Spinner moduleList = (Spinner) findViewById(R.id.module_list);
moduleList.setOnItemSelectedListener(this);
ImageView logo = (ImageView) findViewById(R.id.logo);
logo.startAnimation(AnimationUtils.loadAnimation(this, R.anim.round));
}
示例7: run
import com.google.ads.AdView; //导入依赖的package包/类
@Override
public void run() {
if (adSize == null) {
result = new PluginResult(Status.ERROR, "AdSize is null. Did you use an AdSize constant?");
} else {
adView = new AdView(cordova.getActivity(), adSize, publisherId);
adView.setAdListener(new BannerListener());
LinearLayoutSoftKeyboardDetect parentView =
(LinearLayoutSoftKeyboardDetect) webView.getParent();
if (bannerAtTop) {
parentView.addView(adView, 0);
} else {
parentView.addView(adView);
}
// Notify the plugin.
result = new PluginResult(Status.OK);
}
synchronized (this) {
this.notify();
}
}
示例8: onCreate
import com.google.ads.AdView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_draw_solution);
// Get the solution from the intent
this.solution = this.getIntent().getExtras().getParcelableArrayList(SOLUTION_KEY);
// Add the pages to the ViewPager
ViewPager pager = (ViewPager) findViewById(R.id.viewPager);
pager.setAdapter(new DrawSolutionPageAdapter(this, this.solution));
// Initialize AdMob
AdView adView = (AdView) findViewById(R.id.adView);
adView.loadAd(new AdRequest());
}
示例9: addAdsTo
import com.google.ads.AdView; //导入依赖的package包/类
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);
}
}
示例10: onCreateView
import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
RelativeLayout v = (RelativeLayout) super.onCreateView(inflater, container, savedInstanceState);
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mHideAds, new IntentFilter(ConstsFree.REMOVE_ADS));
/**
* If ads are disabled we don't need to load any
*/
if (!SharedPreferencesHelperFree.getDisableAds(getActivity())) {
mAdView = new AdView(getActivity(), AdSize.SMART_BANNER, ConstsFree.ADMOB_ID);
/**
* The AdView should be attached to the bottom of the screen, with the GridView position above it
*/
RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
v.addView(mAdView, adParams);
mAdView.loadAd(AdUtil.getAdRequest());
}
return v;
}
示例11: onCreateView
import com.google.ads.AdView; //导入依赖的package包/类
@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;
}
示例12: addAD
import com.google.ads.AdView; //导入依赖的package包/类
/**
* 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処理 --- ここまで
}
示例13: onCreate
import com.google.ads.AdView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MainActivity.context = getApplicationContext();
EditText edit = (EditText) findViewById(R.id.editText1);
edit.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
EditText edit1 = (EditText) findViewById(R.id.editText2);
edit1.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
AdView adview = (AdView) findViewById(R.id.adView);
AdRequest req = new AdRequest();
adview.loadAd(req);
mProgress = (ProgressBar) findViewById(R.id.progressBar1);
mProgress.setVisibility(View.INVISIBLE);
}
示例14: onCreateView
import com.google.ads.AdView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(
R.layout.fragment_letter_practice_dummy, container, false);
canvas = (CanvasTextView) rootView
.findViewById(R.id.letterPracticeCanvas);
canvas.setText(getArguments().getStringArray(ARG_LETTER_PHONOLOGY)[1]);
phonologyCanvasLetters = (TextView) rootView
.findViewById(R.id.pronounciationPhonology);
letterPhonologyItems = LetterPhonologyItem.EXAMPLE_PHONOLOGY_LETTERS
.get(getArguments().getStringArray(ARG_LETTER_PHONOLOGY)[0]);
if (letterPhonologyItems != null && phonologyCanvasLetters != null) {
phonologyCanvasLetters
.setText(createTextPhonology(letterPhonologyItems));
}
// load add
AdView adView = (AdView) rootView.findViewById(R.id.ad);
if (adView != null) {
adView.loadAd(new AdRequest());
}
return rootView;
}
示例15: onCreate
import com.google.ads.AdView; //导入依赖的package包/类
@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);
}