나는 서로 옆에 2 개의 버튼이있는 표 레이아웃을 만들려고했습니다. 나는 주변에서 읽었지만, 나는 화면에 아무 것도 보여줄 수 없다. 이것은 TableLayout에 대한 현재 코드입니다.xamarin 각 행에 2 개의 버튼이있는 테이블 레이아웃 만들기
TableLayout ll = FindViewById<TableLayout>(Resource.Id.buttonLayout);
TableLayout llInner = new TableLayout(this);
TableLayout.LayoutParams lp = new TableLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
llInner.Orientation = Orientation.Horizontal;
llInner.LayoutParameters = lp;
llInner.WeightSum = 2;
ll.AddView(llInner);
var i = 0;
var row = new TableRow(this);
//TableRow.LayoutParams rowlayout = new TableRow.LayoutParams(TableRow.LayoutParams.MatchParent, TableRow.LayoutParams.WrapContent);
row.LayoutParameters = lp;
foreach (var series1 in series)
{
var b = new Button(this);
b.Text = series1.Series;
//lp = new TableLayout.LayoutParams(1, LinearLayout.LayoutParams.WrapContent);
b.LayoutParameters = lp;
row.AddView(b);
i =+ 1;
if (i > 1)
{
llInner.AddView(row, new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent));
row = new TableRow(this);
row.LayoutParameters = lp;
i = 0;
}
}
제안 사항? 사전에
덕분에,
비요른
안녕하세요. 왜 .axml 페이지를 사용하지 않으시겠습니까? Xamarin 전통과 Xamarin 양식 디자인 페이지 opmitise입니다. 그리고 매우 유용합니다. –
생성해야하는 버튼의 양이 동적 인 문제가 있습니다. 이는 API에서받은 정보를 기반으로합니다. 그러므로 나는 얼마나 많은 버튼을 만들어야할지 모른다. –