Skip to content

Instantly share code, notes, and snippets.

@AmaroNeto
Created February 26, 2020 17:13
Show Gist options
  • Save AmaroNeto/ba6433992861188a70a8ab0c268bddab to your computer and use it in GitHub Desktop.
Save AmaroNeto/ba6433992861188a70a8ab0c268bddab to your computer and use it in GitHub Desktop.
private fun setViewHeight() {
intro.viewTreeObserver.addOnGlobalLayoutListener(
object : OnGlobalLayoutListener {
override fun onGlobalLayout() {
oldHeight = intro.getHeight()
intro.viewTreeObserver.removeOnGlobalLayoutListener(this)
}
})
detail.viewTreeObserver.addOnGlobalLayoutListener(
object : OnGlobalLayoutListener {
override fun onGlobalLayout() {
newHeight = detail.getHeight()
detail.viewTreeObserver.removeOnGlobalLayoutListener(this)
detail.visibility = View.GONE
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment