how to force onLayout
- by rekisum
Hi i want to design a custom View where I need to recalculate my layout and redraw when user changes something.
To force a onLayout(), the only solution that works for me until now is:
onLayout(true, 0, 0, 0, 0);
invalidate();
Of course that gives me a lint error and I have to add a @SuppressLint("WrongCall").
So there must be a smarter solution.
Calls of forceLayout or requestLayout didn't work.
Probably they only put a request on a stack but don't react immediately.
As my view has no child elements and I do the drawing inside all by myself,
could be I'm bypassing some Android design guides and abusing some principles.
Can live with the lint error but maybe someone already found a solution.
Thanks!