When is the traversals function called?

I'm curious guys

What are the exact cases of doTraversal -> performTraversals ? Since I have rather heavy activity, I want the application to onDraw or sort. performTraversals is pretty heavy, it is trying / measuring if it needs to resize views, something like this, I think. And I don’t need it when I pretend that no other opinion depends on GONE, but, I think, I can’t miss it. Therefore, before breaking into the source of Android, I want to ask. If you know this, feel free to share :)

Thanks Danail

+4
source share
1 answer

performTraversals() has many tasks, but its three main roles:

  • View Measurement
  • Layout Views
  • Drawn views

Each time Android needs to redraw the window, performTraversals() called. This does not mean, however, that the measurement / layout occurs every time the Traversals () function is executed. You cannot skip performTraversals() if you use standard views (only SurfaceView allows you to bypass this when drawing.)

+8
source

Source: https://habr.com/ru/post/1437852/


All Articles