I want to have a 2x2 grid with a buttons inside. This is only ICS so I am trying to use the new GridLayout given.
Here\'s the XML of my layout:
<
You can set width of every child dynamically:
GridLayout.LayoutParams params = (GridLayout.LayoutParams) child.getLayoutParams(); params.width = (parent.getWidth()/parent.getColumnCount()) -params.rightMargin - params.leftMargin; child.setLayoutParams(params);