TableRow マージンについて多くの解決策を見つけましたが、行を試してみるとまったくマージンがありません。
これは私のコードです:
TableLayout table = (TableLayout)findViewById(R.id.myTableLayout);
for (int i = 0; i < 3; i++) {
TableRow tr = new TableRow(this);
LayoutParams layoutParams = new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
int leftMargin=110;
int topMargin=100;
int rightMargin=100;
int bottomMargin=100;
layoutParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin);
tr.setLayoutParams(layoutParams);
tr.setBackgroundResource(R.drawable.shelf_bar);
table.addView(tr, new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
}
これは私の期待される結果です:
誰か私の間違いを指摘してください。ありがとう