how to force onLayout

Posted by rekisum on Stack Overflow See other posts from Stack Overflow or by rekisum
Published on 2014-05-29T09:16:13Z Indexed on 2014/05/29 9:25 UTC
Read the original article Hit count: 176

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about android

Related posts about view