gridLayout.setColumnCount(2); gridLayout.setRowCount(15);
GridLayout gridLayout = new GridLayout(this); gridLayout .setColumnCount(4); ///...
GridLayout gridLayout = new GridLayout(this); gridLayout.setColumnCount(2); gridLayout.setRowCount(4);
linLayout.addView(tv); grd = new GridLayout(this); grd.setColumnCount(colcount); grd.setRowCount(rowcount); grd.setBackgroundColor(Color.YELLOW);
int column = 3; int rowSize = total_gridCount / column; gridLayout.setColumnCount(column);
LayoutParams.MATCH_PARENT)); gl.setOrientation(0); gl.setColumnCount(11); gl.setRowCount(3);
GridLayout buttonLayout = new GridLayout(this); buttonLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); buttonLayout.setOrientation(GridLayout.HORIZONTAL); buttonLayout.setColumnCount(3); //Amount of colums for(int i = 0; i < numberOfButtons; i++) { Button b = new Button(this); b.setText(i); b.setPadding(5,5,5,5); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Do Something on click } buttonLayout.addView(b); }
GridLayout gridLayout = new GridLayout(this); gridLayout.setColumnCount(colCount); gridLayout.setRowCount(rowCount); GridLayout.LayoutParams third = new GridLayout.LayoutParams(0, 0); textView1.setLayoutParams(third); gridLayout.addView(textView1, third); GridLayout.LayoutParams fourth = new GridLayout.LayoutParams(0, 1); cb.setLayoutParams(fourth); gridLayout.addView(cb, fourth); GridLayout.LayoutParams fifth = new GridLayout.LayoutParams(0, 2); textView2.setLayoutParams(fifth ); gridLayout.addView(textView2, fifth);