android - GridLayout LayoutParams - programmatically apply weight and span -
i want apply colspan , rowspan on gridlayout programmatically. have searched lot same. have doubts:
- is there other way can create gridlayout params programmatically??
- can create using generatelayoutparams(attributeset attrs) method? if yes how should it. how can create attributeset programmatically. appreciated. in advance!
if have height , width , want create gridlayout params programmatically use :
gridlayout.layoutparams param =new gridlayout.layoutparams(); param.height = layoutparams.wrap_content; param.width = layoutparams.wrap_content; layoutparams.rowspec = gridlayout.spec(gridlayout.undefined, item.getrowspan()); layoutparams.columnspec = gridlayout.spec(gridlayout.undefined, item.getcolumnspan()); gridlayout.setlayoutparams(param);
Comments
Post a Comment