Skip to content

Instantly share code, notes, and snippets.

@nikhilpanju
Last active December 3, 2019 14:20
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 nikhilpanju/16666645c844176ee411f73e509eb98c to your computer and use it in GitHub Desktop.
Save nikhilpanju/16666645c844176ee411f73e509eb98c to your computer and use it in GitHub Desktop.
cardContainer.doOnLayout { view ->
originalHeight = view.height
// show expandView and record expandedHeight in next
// layout pass (doOnNextLayout) and hide it immediately
expandView.isVisible = true
cardContainer.doOnNextLayout { view ->
expandedHeight = view.height
// We use post{} to hide the view. Otherwise the parent will not
// measure itt again, since this block is done on the layout pass
expandView.post { expandView.isVisible = false }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment