Skip to content

Instantly share code, notes, and snippets.

@B0yma
Created April 24, 2019 07:33
Show Gist options
  • Save B0yma/2c0b4a1653b65ca8149461259badc102 to your computer and use it in GitHub Desktop.
Save B0yma/2c0b4a1653b65ca8149461259badc102 to your computer and use it in GitHub Desktop.
GravityOfDialogFragmentWithMargin
private fun setDialogGravity(gravity: Int) {
val window = dialog?.window
val wlp = window?.attributes
wlp?.gravity = gravity
wlp?.y = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56f, resources.displayMetrics).toInt()
window?.attributes = wlp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment