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です。非常に便利です。 –
sinds作成する必要があるボタンの量は動的なものです。これはAPIから受け取った情報に基づいています。したがって、私はいくつのボタンを作成する必要があるのか分かりません。 –