For the horizontal line
view v = new View(this); v.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, 1));
For the vertical line
view v = new View(this); v.setLayoutParams(new TableRow.LayoutParams(1, TableRow.LayoutParams.MATCH_PARENT));
add this to your code and add it to the table row Programmatically
Edited by:
TableRow row; row=(TableRow)findViewById(R.id.traningprogram_tableRow_mondayHeading); row.addView(v);
if you want to create it in xml use this code after each element of the line ( TextView )
for horizontal line in XML
<View android:layout_width="match_parent" android:background="@android:color/red" android:layout_height="2dp" />
for vertical string in XML
<View android:layout_width="2dp" android:background="@android:color/red" android:layout_height="match_parent"/>
Try it, it will work
source share