1
필드 이름과 필드 값이라는 두 개의 열이있는 양식의 표 레이아웃이 있습니다. 경우에 따라 필드 값이 체크리스트입니다. "checklist"행의 행 높이를 확장하여 listview의 모든 항목을 볼 수있게하고 싶습니다.android tablelayout은 행의 높이를 목록보기 내용으로 확장합니다.
다음 코드는 작은 세로로 스크롤 할 수있는보기의 목록보기를 보여줍니다. 첫 번째 열의 필드 이름과 동일한 높이입니다. 전체 목록을 볼 수 있도록 행 높이를 어떻게 확장합니까? (테이블 셀의 FrameLayout은 아이콘이나 텍스트를 오버레이 할 수 있도록되어 있습니다.)
// get the table
TableLayout table = FindViewById<TableLayout>(Resource.Id.formTable);
// make a new table row
TableRow row = new TableRow(this);
// add the field name (left column)
TextView rowName = new TextView(this);
rowName.Text = field.Name + ":";
rowName.Gravity = GravityFlags.Right | GravityFlags.CenterVertical;
TableRow.LayoutParams tableLayoutParams = new TableRow.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
tableLayoutParams.Gravity = GravityFlags.Right | GravityFlags.CenterVertical;
tableLayoutParams.Weight = 1.0f;
tableLayoutParams.Width = 0;
row.AddView(rowName, tableLayoutParams);
// add the field value (right column - in this case, a listview for a checklist)
FrameLayout frameLayout = new FrameLayout(this);
List<string> strings = field.Items.ToList();
ListView listView = new ListView(this);
listView.Adapter = new ListViewFormAdapterCheckList(this, strings);
frameLayout.AddView(listView);
tableLayoutParams = new TableRow.LayoutParams(TableLayout.LayoutParams.WrapContent, TableLayout.LayoutParams.WrapContent);
tableLayoutParams.SetMargins(0, 10, 0, 0);
tableLayoutParams.Width = 0;
row.AddView(frameLayout, tableLayoutParams);