java - LinearLayout nesting -


is possible create method inflate layout (or create dynamically), add specific views (in case textviews), retun layout view, (somehow) incorporate in main layout in other class, nesting, dynamic adding of elements?

yes possible:

... oncreate()   {   setcontentview(...);   viewgroup mycontainer=(viewgroup)findviewbyid(r.id.mycontainer);   view v=inflatemyspecialview();   //=<set layoutparams view if needed   mycontainer.addview(v);   }  public view inflatemyspecialview()   {   viewgroup viewgroup=(viewgroup ) getlayoutinflater().inflate(r.layout.my_custom_layout, null,false);   //do stuff inflated viewgroup.   return viewgroup;   } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -