I have 2 columns in my GridLayout
. What I want to do is make those columns take up half of the width of the screen each and then have its child contents fill their
adding views dynamically in a grid Layout of 2 columns that take 50% of the available space:
GridLayout gridLayout = new GridLayout();
View view; //it can be any view
GridLayout.LayoutParams param = new GridLayout.LayoutParams();
param.columnSpec = GridLayout.spec(GridLayout.UNDEFINED,GridLayout.FILL,1f);
param.width = 0;
view.setLayoutParams(param);
gridLayout.add(view);
in static way (in .xml file).