I'm trying to make a 100x100 px button and add it to a gridlayout on the position 3,3
Button btn = new Button(this);
btn.setLayoutParams(new ViewGroup.LayoutParams(100,100));
GridLayout grid4x4 = (GridLayout)findViewById(R.id.grid4x4);
//I've narrowed it down to the conclusion that this line is the problem:
grid4x4.addView(btn,new GridLayout.LayoutParams(GridLayout.spec(3),GridLayout.spec(3)));
//if i just use:
//grid4x4.addView(btn); I get the button the size I want it, but I need it to be on
//the 3,3 position of the grid.
This "almost" works, excepting the fact that the button added is bigger than 100x100px as you can see I'm trying to fix the size I want yet for some reason that's not the size I get.
This might not be the ideal solution, but this worked exactly the way I wanted:
Oim~