Created
April 8, 2020 13:14
-
-
Save diousk/bbf01cfac4ac98938f2f2237a8bfc304 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
viewLifecycleOwner.lifecycleScope.launchWhenCreated { | |
// before view laid out | |
requireView().awaitLayout() // coroutine suspended | |
// now view is laid out, we can get the size of view | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment