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


Java NativeExpressAdView.setLayoutParams方法代码示例

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


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

示例1: getExpressAdView

import com.google.android.gms.ads.NativeExpressAdView; //导入方法依赖的package包/类
public static NativeExpressAdView getExpressAdView(Context context, ExpressAdPreset expressAdPreset) {
    NativeExpressAdView adView = new NativeExpressAdView(context);
    AdSize adSize = expressAdPreset.getAdSize();
    adView.setAdSize(adSize);
    adView.setAdUnitId(expressAdPreset.getAdUnitId());
    adView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
            adSize.getHeightInPixels(context)));

    //set video options
    if(expressAdPreset.getVideoOptions() != null)
    adView.setVideoOptions(expressAdPreset.getVideoOptions());

    return adView;
}
 
开发者ID:clockbyte,项目名称:admobadapter,代码行数:15,代码来源:AdViewHelper.java

示例2: AdNativeExpress

import com.google.android.gms.ads.NativeExpressAdView; //导入方法依赖的package包/类
public AdNativeExpress(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    LayoutInflater.from(context).inflate(R.layout.ad_native_express_view, this);
    mNativeAdLayout = (FrameLayout) findViewById(R.id.ad_layout);
    mProgress = findViewById(R.id.progress);
    mAdText = findViewById(R.id.ad_text);
    mGHImage = (AppCompatImageView) findViewById(R.id.gh_image);

    findViewById(R.id.remove_ad).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            ViewUtils.dialogDonate(v.getContext()).show();
        }
    });

    mNativeExpressAdView = new NativeExpressAdView(context);
    mNativeExpressAdView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    mNativeExpressAdView.setAdUnitId(getContext().getString(Utils.DARK_THEME ?
            R.string.native_express_id_dark : R.string.native_express_id_light));
    mNativeExpressAdView.setAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int i) {
            super.onAdFailedToLoad(i);
            mNativeLoading = false;
            mNativeLoaded = false;
            mNativeFailedLoading = true;
            loadGHAd();
        }

        @Override
        public void onAdLoaded() {
            super.onAdLoaded();
            mNativeLoaded = true;
            mNativeLoading = false;
            mNativeFailedLoading = false;
            mProgress.setVisibility(GONE);
            mNativeAdLayout.addView(mNativeExpressAdView);
        }
    });
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:43,代码来源:AdNativeExpress.java


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