First, thank for the article. A question though:
> So you delegate the animation to the next frame and cross your fingers that the view will be ready.
I believe postDelayed()
doesn’t mean “perform this thing on next frame”. By reading the post I got an impression, that you claim, that postDelayed()
gives us a guarantee that an action will be performed on the next frame, which I believe is not quite correct statement. Instead, it will simply add a Message
to a MessageQueue
. Layout inflation might also be considered as set ofMessage
s that are post
ed on MessageQueue
. What this boils down to is following: if you are postDelay
ing a Message
then you have a guarantee that it will be executed *after* layout hierarchy has been laid out, which in turn means, that in the Runnable
of postDelayed
you have a guarantee, that the view has successfully been laid out and its sizes are able to be retrieved.
Let me know if I’m missing something.