2

Here is my method, and this method's output is http://l1304.hizliresim.com/18/f/m1r29.jpg

I don't want any spaces between these buttons. How can i do this?

public void butonOlustur(){
     TableRow layout1 = (TableRow) findViewById(R.id.tableRow1);
     TableRow layout2 = (TableRow) findViewById(R.id.tableRow2);
     TableRow layout3 = (TableRow) findViewById(R.id.tableRow3);
     TableRow layout4 = (TableRow) findViewById(R.id.tableRow4);
     TableRow layout5 = (TableRow) findViewById(R.id.tableRow5);
     TableRow[] layouts = new TableRow[6];
     layouts[0]=layout1;
     layouts[1]=layout2;
     layouts[2]=layout3;
     layouts[3]=layout4;
     layouts[4]=layout5;
     Button[][] myButton = new Button[4][25];
     for(int j = 0; j <myButton.length; j++){
     for(int i =0 ; i <25; i++){

         Button temp = new Button(this);
         myButton[j][i] = temp;
         layouts[j].addView(myButton[j][i], 15, 15);


     }
     layouts[j] = layouts[j+1];
     }


    }
4

1 回答 1

0

请参阅此处此处回答的类似问题。

基本上,您可以创建自己的 9patch 图像,或者只是将 layout_marginLeft 和 layout_marginRight 更改为负值。

如果您决定设置边距,您将不希望以像素为单位进行设置。要将边距设置为 dp 而不是像素,您可以使用此答案中的公式。

于 2013-04-13T21:21:57.893 回答