나는 코드에서 동적으로 생성 된 TableRows
을 가지고 있으며 이것들에 대한 여백을 설정하려고합니다. TableRows
. 프로그래밍 방식으로 TableRow의 여백 설정
TableRows
다음과 같이 생성 :
// Create a TableRow and give it an ID
TableRow tr = new TableRow(this);
tr.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
Button btnManageGroupsSubscriptions = new Button(this);
btnManageGroupsSubscriptions.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, 40));
tr.addView(btnManageGroupsSubscriptions);
contactsManagementTable.addView(tr);
가 어떻게 동적으로 이들에 대한 여백을 설정합니까?
Worked! Tnx !!! – ofirbt
텍스트 뷰는 어떻습니까? textView에 대해 setMargins가 정의되지 않았습니다. – Jaseem
작동하지 않았습니다. 하지만 아래의 @mik의 대답이 효과가 있었고 받아 들여진 대답이었을 것입니다. – Zvi