以编程方式创建了一个表格布局。它看起来像这样。
在这里我想在每一行之后添加水平线,如何以编程方式进行。创建表格布局的示例代码
ScrollView scrollView = new ScrollView(this);
TableLayout resultLayout = new TableLayout(this);
resultLayout.setStretchAllColumns(true);
resultLayout.setShrinkAllColumns(true);
TableRow tablerowMostRecentVehicle = new TableRow(this);
tablerowMostRecentVehicle.setGravity(Gravity.CENTER_HORIZONTAL);
TextView textViewMostRecentVehicle = new TextView(this);
textViewMostRecentVehicle.setText("Most Recent Vehicle Details");
textViewMostRecentVehicle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
textViewMostRecentVehicle.setTypeface(Typeface.SERIF, Typeface.BOLD);
tablerowMostRecentVehicle.addView(textViewMostRecentVehicle);
// ...
resultLayout.addView(tablerowMostRecentVehicle);
resultLayout.addView(tableRowRegistrationMark);
resultLayout.addView(tableRowMakeModel);
resultLayout.addView(tableRowColour);
resultLayout.addView(tableRowChasisNo);
resultLayout.addView(tableRowDateofFirstUse);
resultLayout.addView(tableRowTypeofFuel);
// ...