android - Why view.onLayout() is called repetitively when changed=false? -
from official docs:
protected void onlayout (boolean changed, int left, int top, int right, int bottom) parameters changed new size or position view left left position, relative parent top top position, relative parent right right position, relative parent bottom bottom position, relative parent
why custom view called repetitively changed=false
? normal?
here's call tree:
synoptic.onlayout(boolean, int, int, int, int) line: 130 synoptic(view).layout(int, int, int, int) line: 11282 synoptic(viewgroup).layout(int, int, int, int) line: 4224 relativelayout.onlayout(boolean, int, int, int, int) line: 925 relativelayout(view).layout(int, int, int, int) line: 11282 relativelayout(viewgroup).layout(int, int, int, int) line: 4224 linearlayout.setchildframe(view, int, int, int, int) line: 1628 linearlayout.layouthorizontal() line: 1617 linearlayout.onlayout(boolean, int, int, int, int) line: 1401 linearlayout(view).layout(int, int, int, int) line: 11282 linearlayout(viewgroup).layout(int, int, int, int) line: 4224 swipeview(framelayout).onlayout(boolean, int, int, int, int) line: 431 swipeview(horizontalscrollview).onlayout(boolean, int, int, int, int) line: 1382 swipeview.onlayout(boolean, int, int, int, int) line: 154 swipeview(view).layout(int, int, int, int) line: 11282 swipeview(viewgroup).layout(int, int, int, int) line: 4224 linearlayout.setchildframe(view, int, int, int, int) line: 1628 linearlayout.layoutvertical() line: 1486 linearlayout.onlayout(boolean, int, int, int, int) line: 1399 linearlayout(view).layout(int, int, int, int) line: 11282 linearlayout(viewgroup).layout(int, int, int, int) line: 4224 framelayout.onlayout(boolean, int, int, int, int) line: 431 framelayout(view).layout(int, int, int, int) line: 11282 framelayout(viewgroup).layout(int, int, int, int) line: 4224 linearlayout.setchildframe(view, int, int, int, int) line: 1628 linearlayout.layoutvertical() line: 1486 linearlayout.onlayout(boolean, int, int, int, int) line: 1399 linearlayout(view).layout(int, int, int, int) line: 11282 linearlayout(viewgroup).layout(int, int, int, int) line: 4224 phonewindow$decorview(framelayout).onlayout(boolean, int, int, int, int) line: 431 phonewindow$decorview(view).layout(int, int, int, int) line: 11282 phonewindow$decorview(viewgroup).layout(int, int, int, int) line: 4224 viewrootimpl.performtraversals() line: 1514 viewrootimpl.handlemessage(message) line: 2467 viewrootimpl(handler).dispatchmessage(message) line: 99 looper.loop() line: 137 activitythread.main(string[]) line: 4424 method.invokenative(object, object[], class, class[], class, int, boolean) line: not available [native method] method.invoke(object, object...) line: 511 zygoteinit$methodandargscaller.run() line: 784 zygoteinit.main(string[]) line: 551 nativestart.main(string[]) line: not available [native method]
the key part here docs is:
called layout when view should assign size , position each of children.
if view inside viewgroup set wrap_content , changes size (e.g. text inside textview changes longer string) onlayout in viewgroup occur. because views given size when laid out, without call view never given new size.
Comments
Post a Comment