android - Why does calling setLayoutParams on subview trigger layout on parent view -


i have custom view textview inside it. when update layoutparams of textview, requestlayout trigger on parent view. know why? there way position textview inside parent without having re-layout entire parent view?

relativelayout.layoutparams params = (relativelayout.layoutparams)childtextview.getlayoutparams(); params.setmargins(0, 100, 0, 0); childtextview.setlayoutparams(params); 

the setlayoutparams call above triggers layout pass avoid.

--- ??

no!!

do know layoutparams does ? does, , function seeing.

parents best care children based on have, derived children - layoutparams tells parent how child suppose treated. if changes parent needs re-adjust care towards child.

so no there no way -(you have live that.)


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -