Pick the fix
A custom progress ring changes colour every frame and the trace shows measure and layout each time. What should it call?
Hint 1 of 1
Did the size or position change?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A invalidate()
Correct. Only drawing changed, so a redraw is enough.
Why not the others?
- B
requestLayout(). That re-measures and re-lays out the tree for no reason. - C
forceLayout(). That marks the view for layout on the next pass; still unneeded. - D
postInvalidateDelayed(0)plusrequestLayout(). Adds the same unneeded layout pass.