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


Java NativeExpressAdView.setVisibility方法代码示例

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


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

示例1: onCreateView

import com.google.android.gms.ads.NativeExpressAdView; //导入方法依赖的package包/类
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_slash, container, false);
        // initialize Admob
        MobileAds.initialize(mActivity, APP_ID);
        NativeExpressAdView adView = view.findViewById(R.id.adView);
        AdRequest request = new AdRequest.Builder()
//                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
//                .addTestDevice("0ACA1878D607E6C4360F91E0A0379C2F")
//                .addTestDevice("4DA2263EDB49C1F2C00F9D130B823096")
                .build();
        adView.loadAd(request);
        if (!adView.isLoading()) {
            adView.setVisibility(View.GONE);
        }
        return view;
    }
 
开发者ID:Art2Cat,项目名称:MoonlightNote,代码行数:20,代码来源:SlashFragment.java

示例2: onAdFailed

import com.google.android.gms.ads.NativeExpressAdView; //导入方法依赖的package包/类
@Override
public void onAdFailed(int adIdx, int errorCode, Object adPayload) {
    NativeExpressAdView adView = (NativeExpressAdView)adPayload;
    if (adView != null) {
        ViewParent parent = adView.getParent();
        if(parent == null || parent instanceof RecyclerView)
            adView.setVisibility(View.GONE);
        else {
            while (parent.getParent() != null && !(parent.getParent() instanceof RecyclerView))
                parent = parent.getParent();
            ((View) parent).setVisibility(View.GONE);
        }
    }
    int pos = getAdapterCalculator().translateAdToWrapperPosition(Math.max(adIdx,0));
    notifyItemRangeChanged(pos, pos+15);
}
 
开发者ID:clockbyte,项目名称:admobadapter,代码行数:17,代码来源:AdmobExpressRecyclerAdapterWrapper.java

示例3: loadNativeAd

import com.google.android.gms.ads.NativeExpressAdView; //导入方法依赖的package包/类
protected void loadNativeAd() {
    try {
        mNativeExpressAdView = (NativeExpressAdView) findViewById(R.id.native_ad_view);
        if (mNativeExpressAdView != null) {
            if (BuildConfig.IS_PREMIUM_USER) {
                mNativeExpressAdView.setVisibility(View.GONE);
            } else {
                mNativeExpressAdView.loadAd(new AdRequest.Builder().build());
            }
        }
    } catch (Exception e) {

    }
}
 
开发者ID:tranleduy2000,项目名称:ascii_generate,代码行数:15,代码来源:AdBannerActivity.java

示例4: onAdFailed

import com.google.android.gms.ads.NativeExpressAdView; //导入方法依赖的package包/类
@Override
public void onAdFailed(int adIdx, int errorCode, Object adPayload) {
    NativeExpressAdView adView = (NativeExpressAdView)adPayload;
    if (adView != null) {
        ViewParent parent = adView.getParent();
        if(parent == null || parent instanceof ListView)
            adView.setVisibility(View.GONE);
        else {
            while (parent.getParent() != null && !(parent.getParent() instanceof ListView))
                parent = parent.getParent();
            ((View) parent).setVisibility(View.GONE);
        }
    }
    notifyDataSetChanged();
}
 
开发者ID:clockbyte,项目名称:admobadapter,代码行数:16,代码来源:AdmobExpressAdapterWrapper.java

示例5: onCreate

import com.google.android.gms.ads.NativeExpressAdView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_celebrity);

    type = getIntent().getStringExtra("type");

    todayMovie = new Gson().fromJson(
            sharedPref.getString("movie_json", ""),
            MovieBean.class
    );
    if (todayMovie == null) {
        finish();
    }

    subjectPB = (ProgressBar) findViewById(R.id.subject_loading);

    celebrityImageIV = (ImageView) findViewById(R.id.celebrity_image);
    celebrityNameTV = (TextView) findViewById(R.id.celebrity_name);
    genderTV = (TextView) findViewById(R.id.gender);
    bornPlaceTV = (TextView) findViewById(R.id.born_place);
    akaEnTV = (TextView) findViewById(R.id.aka_en);
    akaTV = (TextView) findViewById(R.id.aka);
    subjectTitleTV = (TextView) findViewById(R.id.subject_title);
    gotoDouban = (Button) findViewById(R.id.goto_douban);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    recyclerView = (RecyclerView) findViewById(R.id.subject_recycler_view);
    subjectMoreBtn = (Button) findViewById(R.id.subject_more);
    celebrityInfo = (LinearLayout) findViewById(R.id.celebrity_info);
    ratingUs = (LinearLayout) findViewById(R.id.rating_us_card);
    adView = (NativeExpressAdView) findViewById(R.id.adView);

    findViewById(R.id.after_ad_closed_rate).setOnClickListener(this);
    findViewById(R.id.after_ad_closed_restore).setOnClickListener(this);

    initView();

    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_24dp);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    // ad
    if (settingPref.getBoolean("ad_show", true)) {
        adView.setVisibility(View.VISIBLE);
        ratingUs.setVisibility(View.GONE);
        initAd();
    } else {
        adView.setVisibility(View.GONE);
        ratingUs.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:SEALiu,项目名称:Calendouer,代码行数:56,代码来源:CelebrityActivity.java


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