Skip to content

Instantly share code, notes, and snippets.

@fercarcedo
Last active March 19, 2020 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fercarcedo/ecef77624cdd3a8af286573e8b0deeaf to your computer and use it in GitHub Desktop.
Save fercarcedo/ecef77624cdd3a8af286573e8b0deeaf to your computer and use it in GitHub Desktop.
val inputLayoutMarginBottom = inputLayout.marginBottom
val callback = object : WindowInsetsAnimation.Callback(DISPATCH_MODE_STOP) {
override fun onProgress(insets: WindowInsets, animations: MutableList<WindowInsetsAnimation>): WindowInsets {
inputLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
updateMargins(bottom = inputLayoutMarginBottom +
insets.getInsets(WindowInsets.Type.ime()).bottom)
}
return insets
}
}
inputLayout.setWindowInsetsAnimationCallback(callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment