juliocbcotta
05/24/2017, 1:24 PMOnGlobalLayoutListener
, but I am not being able to reference the listener to remove it after the action is taken. The code below fails to remove the listener. Could someone point me to the right direction?
view.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
// Do stuff and remove listener
view.viewTreeObserver.removeOnGlobalLayoutListener { this }
}
})