c# XAMARIN TableLayout 创建表格

创建带滚动条子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;
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值