0

I am using Appodeal.show(getActivity(),Appodeal.BANNER_BOTTOM); to position banner ad at the bottom of screen , but i want to keep some space between the ad and the bottom of the screen around 20dp because there is a share button which gets covered by the ad. So , how to position the bottom banner ad leaving some space below using java.

Girish
  • 21
  • 6

1 Answers1

0

You can add the desired margins using something like this. Just call this method whenever you are creating the adview.

private void setBottomMargins (AdView adView, int bottomMargin) {
    if (adView.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
      ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) adView.getLayoutParams();
      layoutParams.setMargins(0, 0, 0, bottomMargin);
      adView.requestLayout();
    }
  }
halfer
  • 19,824
  • 17
  • 99
  • 186
Atiq
  • 14,435
  • 6
  • 54
  • 69