3

I have created an Adview and moved it to the bottom of the screen. The adview starts correctly on the bottom, but whenever the adview loads a new ad, it briefly jumps to the top of the screen, then returns to the bottom.

I initialize and show the Adview like this...

//
// Create Adview...
//
mBanner=new AdView(mActivity);
mBanner.setAdSize(AdSize.SMART_BANNER);
mBanner.setAdUnitId("...my admob id...");
mBanner.setAdListener(new AdListener()
{
    @Override public void onAdLoaded() {mBannerLoaded=true;}
    @Override public void onAdFailedToLoad(int errorCode) {mBannerLoaded=false;mActivity.Out("(Banner)onAdFailedToLoad: "+errorCode);if (errorCode==3) ShowBanner(true);}
    @Override public void onAdOpened() {}
    @Override public void onAdLeftApplication() {}
    @Override public void onAdClosed() {mBannerLoaded=false;}
});

//
// Position it at the bottom of the activity's layout...
//
RelativeLayout.LayoutParams aParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
aParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
mActivity.mLayout.setGravity(Gravity.BOTTOM);
aParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mActivity.mLayout.addView(mBanner,aParams);

//
// Load the ad...
//
Bundle aExtras=new Bundle();
aExtras.putString("max_ad_content_rating",mActivity.mContentRating);
if (Build.VERSION.SDK_INT>18) if (ConsentInformation.getInstance(mActivity.getApplicationContext()).isRequestLocationInEeaOrUnknown()) if (mActivity.mConsentStatus != ConsentStatus.PERSONALIZED) aExtras.putString("npa", "1");
mBanner.loadAd(new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,aExtras).build());

Expected Result: The Adview is always at the bottom of the screen, no matter what.

Actual Result: Whenever it refreshes with a new ad (and this seems to be only more complex ads with child views-- a simple image ad or text ad is fine) the Adview will flicker up to the top of the screen for a moment (for what seems like one frame), then return to the bottom.

Raptisoft
  • 203
  • 1
  • 10
  • Did you find the solution to this? I'm experiencing the same problem, but only with some specific ads – jmart Aug 11 '21 at 11:08

0 Answers0