android - ViewGroup finish inflate event -


i have created custom layout extends viewgroup. working fine , getting layout expected.

i want dynamically change element in layout. not working calling in oncreate , till time entire layout not (drawn) inflated onto screen , hence not have actual size.

is there event can used find out when inflation of layout done? tried onfinishinflate not work viewgroup has multiple views , called multiple times.

i thinking of creating interface in custom layout class not sure when fire it?

if understand requirements correctly, ongloballayoutlistener may give need.

  view myview=findviewbyid(r.id.myview);   myview.getviewtreeobserver().addongloballayoutlistener(new viewtreeobserver.ongloballayoutlistener() {             @override             public void ongloballayout() {                 //at point layout complete ,                  //dimensions of myview , child views known.             }         }); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -