V
V
vantic1312016-05-19 00:04:21
Android
vantic131, 2016-05-19 00:04:21

How to wait for elements inserted via addView() to be rendered?

The bottom line is simple, I insert elements into the block through addView, and then I try to measure their size through getWidth(), which returns 0, but if you call getWidth() by clicking on the button, for example, the size gets right after drawing, hence the conclusion that the elements are simply they don’t have time to render at the time of the request, I think there must be some kind of callback or some kind of trick, unfortunately the search in the documentation and in Google did not give a single reasonable explanation.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#algooptimize #bottize, 2016-05-19
@vantic131

stackoverflow.com/questions/10006548/calculate-vie...
stackoverflow.com/questions/3591784/getwidth-and-g...
Will this work?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question