ボタンでテーブルレイアウトを動的に作成しようとしています。私はボタンでテーブルレイアウトを得ることができます。私はボタンの間にパディングが必要です。私はどのようにプログラム的に得ることができます。テーブルレイアウトの列にパディングを動的に設定する方法
私は私が....感謝を教えてください
private void showCowsTblField()
{
for (int row = 0; row < numberOfRowsInField-1; row++)
{
TableRow tableRow = new TableRow(this);
tableRow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
for (int column = 0; column < numberOfColumnsInField -1; column++)
{
blocks[row][column].setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
blocks[row][column].setPadding(blockPadding, blockPadding, blockPadding, blockPadding);
tableRow.addView(blocks[row][column]);
tableRow.setPadding(blockPadding, blockPadding, blockPadding, blockPadding);
}
tblCows.addView(tableRow,new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
}
}
BT次のコードを試してみました。
はい、それは良いです。 – fiction