Reputation: 2557
I want to apply colspan and rowspan on GridLayout programmatically. I have searched a lot for same. I have some doubts:
Upvotes: 1
Views: 2634
Reputation: 1989
if you have height and width and just want to create GridLayout params programmatically use this :
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);
Upvotes: 1