简体   繁体   中英

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'

this error comes in android 9.0 devices

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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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