Android-Change Layout of view dynamically -


i have view in activity :

for(int i=0;i<my_newsgroup.size();i++)     {         view my_updateview=new view(mainactivity.this);         my_updateview =layoutinflater.from(mainactivity.this).inflate(r.layout.row2, null); .....     } 

now want change layout of view dynamically !

how can ?

tnx ---------------------------------edit-------------------

linearlayout ll2 = (linearlayout)findviewbyid(r.id.parent2);     for(int i=0;i<my_newsgroup.size();i++)     {         view my_updateview=new view(mainactivity.this);         my_updateview = layoutinflater.from(mainactivity.this).inflate(r.layout.row2, null);                       ....                      .....                   relativelayout.layoutparams relativeparams = new relativelayout.layoutparams(layoutparams.fill_parent, layoutparams.fill_parent);          ll2.addview(my_updateview,relativeparams);          myviewlist.add(my_updateview);     } 

myviewlist : list myviewlist=new arraylist();

and ! example if want hide view :

myviewlist.get(pos).setvisibility(view.gone); 

but want change layout view !

you can't change view , reinflate different xml layout. can change view's container content. remove old view viewgroup , replace new one. here trivial example:

framelayout somelayout... somelayout.removeview(viewyouwanttoreplace); somelayout.addview(inflator.inflate(r.layout.row2, somelayout, false)); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -