Android: Increase height of linear layout while adding ImageViews to it -
i trying add imageviews drag , drop linearlayout. after adding 5 imageviews, linearlayout size should increase , imageviews should add in next line of linerlayout. trying add 5 sets of imageviews in linearlayout. first 5 in first line, next 5 in 2nd line etc...
any idea how achieve this. tried in following manner imageviews not added after increasing height of linerlayout.
case dragevent.action_drop: if(v == findviewbyid(r.id.dragdropherelinear)) { view view = (view) event.getlocalstate(); viewgroup viewgroup = (viewgroup) view.getparent(); //viewgroup.removeview(view); imageview iv = new imageview(getapplicationcontext()); linearlayout containview = (linearlayout) v; textview textview = (textview) findviewbyid(r.id.tvdragdrophere); if(count > 4 ) { count = 0; containview.getlayoutparams().height = containview.getlayoutparams().height + 200; containview.requestlayout(); //invalidate(); } iv.setpadding(5, 0, 5, 0); containview.addview(iv); iv.setvisibility(view.visible); view.setvisibility(view.visible); count++; } else { view view = (view) event.getlocalstate(); view.setvisibility(view.visible); context context = getapplicationcontext(); toast.maketext(getapplicationcontext(), "problem in dropping image", toast.length_long).show(); } break;
you set in layout height ="match_parent" in xml file or can set dynamically this.....
layoutparams layoutparams = (layoutparams) layoutname.getlayoutparams(); layoutparams.width = framelayout.layoutparams.fill_parent; layoutparams.width = framelayout.layoutparams.wrap_content;
Comments
Post a Comment