Skip to content

InMobiBannerCustomEvent.java -  #1

@c3ph3us

Description

@c3ph3us

even height is set some inmobi api is disobeying size and making view to whole screen size

   imbanner.setLayoutParams(new ViewGroup.LayoutParams(Math.round(320 * dm.density), Math.round(50 * dm.density));
  • and i see when the view is laid out it layout params are -2 (wrap content) and child to fill parent

quick fix (workaround) is to make little change:

    imbanner.setLayoutParams(new ViewGroup.LayoutParams(Math.round(320 * dm.density), height));
    imbanner.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            ViewGroup.LayoutParams layoutParams = v.getLayoutParams();
            layoutParams.height = height;
            v.setLayoutParams(layoutParams);
        }
    });

btw you shouldn't make layout params as LinearLaoyut but generate from parent !!!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions