Photo by Pixabay on Pexels.com
GridView grid = new GridView(this); 
линеар.addView(grid); 
grid.setNumColumns(3); 
grid.setColumnWidth(25); 
grid.setHorizontalSpacing(8); 
grid.setVerticalSpacing(8); 
grid.setAdapter(new GridViewAdapter(nameListMap,"name of layout"));