我正在尝试动态更改按钮大小,但使用后setWidth()并setHeight()没有任何反应。
这是我的代码...
GridLayout grid = (GridLayout)findViewById(R.id.grid);
grid.setColumnCount(10);
grid.setRowCount(10);
cells = new Button[100];
for (int i = 0; i < cells.length; i++) { 
    cells[i] = new Button(this);
    cells[i].setWidth(grid.getWidth()/10);
    cells[i].setHeight(grid.getHeight()/10);
    grid.addView(cells[i]);
}
有什么想法/解决方案吗?