Today a mate asked me how he could do an OnGlobalLayoutListener properly without incurring in the need of too much boilerplate. This was a tricky question because of a couple of things, let’s see it a little more deeply. What is OnGlobalLayoutListener for? This listener is available for any view’s ViewTreeObserver and it’s quite often used to get a callback when the view is inflated and measured,
![Kotlin recipes for Android (I): OnGlobalLayoutListener](https://cdn-ak-scissors.b.st-hatena.com/image/square/1e84f567a3ca128e1502ead607c3732b9d04cc17/height=288;version=1;width=512/https%3A%2F%2Fantonioleiva.com%2Fwp-content%2Fuploads%2F2016%2F03%2Fkotlin_logo_new.png)