简体   繁体   English

智能横幅加载到全屏尺寸

[英]Smart banner loading to full screen size

Smart banner load Adapting to full screen size ads are loading like following image 智能横幅加载适应全屏尺寸的广告正在加载,如下图所示 在此处输入图片说明

how to solve this problem 如何解决这个问题呢

when video load in smart banner this problem comes 在智能横幅中加载视频时,就会出现此问题

i am used in latest fcm ads dependancy 'com.google.firebase:firebase-ads:18.1.0' 我用于最新的fcm广告依赖项'com.google.firebase:firebase-ads:18.1.0'

this error comes in android 9.0 devices 此错误来自android 9.0设备

my code are following 我的代码如下

 public static LinearLayout add;
        public static AdView adView;
        public static AdRequest request;

    public void load_add(final LinearLayout addViw) {
            adView = new AdView(Main_open.this);
            adView.setAdSize(AdSize.SMART_BANNER);
            adView.setAdUnitId(BANNAER_ID);
            request = new AdRequest.Builder().build();

            sharedPreference.putInt(getApplicationContext(), "addloded", 0);
            adView.setAdListener(new AdListener() {
                public void onAdLoaded() {
                    sharedPreference.putInt(getApplicationContext(), "addloded", 1);
                    Main_open.load_addFromMain(Main_open.this, add);

                    super.onAdLoaded();
                }

                public void onAdFailedToLoad(int errorcode) {
                    /*load_add(addViw);*/
                }
            });

            adView.loadAd(request);
            if (adView != null) {
                ViewGroup parentViewGroup = (ViewGroup) adView.getParent();
                if (parentViewGroup != null) {
                    parentViewGroup.removeAllViews();
                }
            }
        }

        public static void load_addFromMain(Context context, LinearLayout add_banner) {
            add = add_banner;
            try {
                if (adView != null) {
                    ViewGroup parentViewGroup = (ViewGroup) adView.getParent();
                    if (parentViewGroup != null) {
                        parentViewGroup.removeAllViews();
                    }
                }
                if (sharedPreference.getInt(context, "addloded") == 1) {
                    add_banner.setVisibility(View.VISIBLE);
                    add_banner.removeAllViews();
                    add_banner.addView(adView);
                }

            } catch (Exception e) {
                System.out.println("Ad Exception " + e);
            }

        }
    LinearLayout ads_lay = findViewById(R.id.ads_lay);
    load_addFromMain(CashList_Fragment.this, ads_lay);

I am not sure but put this code in a menifest file under application tag 我不确定,但是将此代码放在应用标签下的清单文件中

 <uses-library
        android:name="org.apache.http.legacy"
        android:required="false" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM