创建带滚动条子TableLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_row="7"
android:layout_column="0"
android:layout_columnSpan="4"
>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"android:accessibilityHeading=""
android:layout_columnSpan="4"
android:id="@+id/tableLayout1">
</TableLayout>
</HorizontalScrollView>
</ScrollView>
var layout = (TableLayout)FindViewById(Resource.Id.tableLayout1);
//var header = AddHeader();
layout.AddView(添加头部行());
layout.AddView(Add添加商品信息(null,null));
public View 添加头部行()
{
var header = new TableRow(this);
header.LayoutParameters = new TableLayout.LayoutParams(TableLayout.LayoutParams.FillParent,
TableLayout.LayoutParams.WrapContent);
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_进货订单号")));
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_供应商姓名"), Color.OrangeRed));
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_发货时间")));
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_订单状态"), Color.OrangeRed));
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_结算情况"), Color.OrangeRed));
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_合计金额"), Color.OrangeRed));
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "进单时间"), Color.OrangeRed));
header.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_制单员"), Color.OrangeRed));
return header;
}
public View Add添加商品信息(Model.进货表_生成订单 mo1,Model.进货表_订单商品信息 mo2)
{
var tableRow = new TableRow(this);
tableRow.LayoutParameters = new TableLayout.LayoutParams(TableLayout.LayoutParams.FillParent,
TableLayout.LayoutParams.WrapContent);
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo1.供应商姓名)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.数量, Color.OrangeRed)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.商品名)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.重量)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.单价)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.商品金额)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.进单时间)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.操作人员)));
//tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", mo2.配送方式)));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_进货订单号")));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_供应商姓名"), Color.OrangeRed));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_发货时间")));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_订单状态"), Color.OrangeRed));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_结算情况"), Color.OrangeRed));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_合计金额"), Color.OrangeRed));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "进单时间"), Color.OrangeRed));
tableRow.AddView(_dynaControl.NewText(this, string.Format("{0} ", "_制单员"), Color.OrangeRed));
tableRow.AddView(_dynaControl.AddButton(this, "编辑订单"));
tableRow.AddView(_dynaControl.AddButton(this, "删除订单"));
return tableRow;
}