android - How to change Nested layout's child viewgroup's width in java code? -


i have layout xml file linear layout. 1 of children again viewgroup relative layout. in java code want change width of child viewgroup requirements. tried this

enter code here      viewgroup childviewgroup = (linearlayout)findviewbyid(childviewgroup);     layoutparams l = childviewgroup.getlayoutparams();     l.width = 360;      childviewgroup .setlayoutparams(l); 

i couldn't because findviewbyid(childviewgroup) doesn't fetch viewgroups views.

note: cant define whole new layout.xml minor requirement since huge layout file , might cause performance overhead. wanted change width of child view group in java activity code.

thanks in advance help.

viewgroup subclass of view findviewbyid should work fine. you're casting result linearlayout, childviewgroup linearlayout or relativelayout specified in question? – codelark oct 6 @ 23:21


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -