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
Post a Comment