How to set divider between columns in tablelayout?

android, android-tablelayout, divider

Solution

Add android:showDividers="middle"

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="horizontal" 
  android:stretchColumns="*"
  android:padding="5dip"
  android:divider="@drawable/tracking_green"
  android:showDividers="middle"
>

Problem

I want to create a table with column dividers. I want to divide my columns with a vertical bar image. To achieve this I have used `"android:divider="@drawable/abc"` but its not working. Below is my xml file for same: ``` <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:stretchColumns="*" android:padding="5dip" android:divider="@drawable/tracking_green" > <TableRow > <TextView android:id="@+id/retaileritem1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="xxxxxxx" /> <TextView android:id="@+id/retaileritem2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="xxxxxxx" /> <ImageView android:id="@+id/retailerimage1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:src="@drawable/tracking_green" /> </TableRow> ```

Original source