LayoutManager (LayoutManager layout, int rowDelta, int columnDelta) { GridLayoutManager oldLayout = (GridLayoutManager) layout; final GridLayoutManager newLayout = new GridLayoutManager(oldLayout.getRowCount() + rowDelta, oldLayout.getColumnCount() + columnDelta); newLayout.setMargin(oldLayout.getMargin()); newLayout.setHGap(oldLayout.getHGap()); newLayout.setVGap(oldLayout.getVGap()); return newLayout; }