跳到主要内容

你不是已登录。您的编辑将被放置在队列中,直到同行评审.

我们欢迎编辑,使文章更容易理解,对读者更有价值。由于社区成员审阅了编辑内容,请尝试使帖子比您发现的更好,例如,通过修改语法或添加其他资源和超链接。

如何在android中用水平线编程分隔表行

以编程方式创建了一个表布局。它看起来像这样。在此处输入图像描述

在这里,我想在每行后面添加水平线,如何通过编程实现。创建表格布局的示例代码

ScrollView ScrollView=新的ScrollView(this);TableLayout resultLayout=新表布局(this);resultLayout.setStretchAllColumns(true);resultLayout.setShrinkAllColumns(true);TableRow tablerowMostRentVehicle=新TableRow(this);表格rowMostRecentVehicle.setGravity(Gravity.CENTER_HORIZONTAL);TextView textViewMostRentVehicle=新文本视图(this);textViewMostRecentVehicle.setText(“最新车辆详细信息”);textViewMostRecentVehicle.setTextSize(类型值.COMPLEX_UNIT_DIP,12);textViewMostRecentVehicle.setTypeface(字体.SERIF,字体.BOLD);tablerowMostRecentVehicle.addView(textViewMostRentVehicle);// ...resultLayout.addView(表格最新车辆);resultLayout.addView(表格行注册标记);resultLayout.addView(tableRowMakeModel);resultLayout.addView(tableRowColour);resultLayout.addView(tableRowChasisNo);resultLayout.addView(表格行首次使用日期);resultLayout.addView(tableRowTypeofFuel);// ...

答案

取消