Skip to content

Instantly share code, notes, and snippets.

@indraAsLesmana
Last active January 13, 2021 23:14
Show Gist options
  • Save indraAsLesmana/640d083598e535d8b001f71f2a5e0d5d to your computer and use it in GitHub Desktop.
Save indraAsLesmana/640d083598e535d8b001f71f2a5e0d5d to your computer and use it in GitHub Desktop.
Add dinamic buttom margin, when scrren in immersive mode/fullscreen
private fun setDinamicAdsMarginFullscreenMode() {
val bottomMargin = getNavigationBarHeight(this, resources.configuration.orientation)
if (adView?.layoutParams is MarginLayoutParams) {
(adView?.layoutParams as MarginLayoutParams).setMargins(
0,
top,
0,
bottomMargin
)
adView?.requestLayout()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment