title: Draw custom line between two elements in TableLayout Android
body: <p>I have an activity with events organised in a timeline. But it looks ugly. </p>
  
  <p><img src="https://i.stack.imgur.com/SOsdI.png" alt="enter image description here"></p>
  
  <p>I want to design a more beautiful timeline like this one.
  <img src="https://i.stack.imgur.com/IJCaV.png" alt="enter image description here"></p>
  
  <p>Is there any simple way or a library to draw lines between elements like in my example?</p>
  
  <pre><code>&lt;ScrollView
      android:layout_marginTop="10dp"
      android:layout_marginLeft="10dp"
      android:layout_width="fill_parent"
      android:layout_height="match_parent"
      android:layout_below="@+id/text_data"
      android:layout_above="@+id/button_trimite"
      android:id="@+id/scroll_timeline"
      android:layout_marginBottom="7dp"
  
      &gt;
      &lt;TableLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/timelineTable"
  
          &gt;
  
  
      &lt;/TableLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>This is my xml. But my TableLayout is generated dynamically because I need to sort my events.</p>
  
  <pre><code>for (final Event e : events) {
          if(e.getDate().equals(dataComp)) {
              //tablerow with event entry
              final TableRow row = new TableRow(getActivity());
  
              row.setLayoutParams(new TableRow.LayoutParams(
                      TableRow.LayoutParams.MATCH_PARENT,
                      TableRow.LayoutParams.WRAP_CONTENT));
  
              if (indexForDrawable % 2 == 0)
                  row.setBackgroundResource(R.drawable.marcaj_event_albastru);
              else
                  row.setBackgroundResource(R.drawable.marcaj_event_portocaliu);
  
              TextView txtEvent = new TextView(getActivity());
              txtEvent.setText("    "+ e.getHour() +"-"+e.getType()+"-"+e.getTitle());
              txtEvent.setTextColor(Color.BLACK);
              txtEvent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, trEvent);
              txtEvent.setTypeface(Typeface.create(tf, Typeface.BOLD));
  
              row.addView(txtEvent);
              row.setClickable(true);
              final String date = e.getDate(), hour = e.getHour(), title = e.getTitle(),
                      type = e.getType(), descriere = e.getDescriere();
              final int finalResource = resource;
              final int finalIndexForDrawable = indexForDrawable;
              row.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      row.setBackground(getActivity().getResources().getDrawable(finalResource));
                      showPopup2(date, hour, type, title, descriere, row, finalIndexForDrawable);
                  }
              });
  
  
              timelineTable.addView(row, new TableLayout.LayoutParams(
                      TableLayout.LayoutParams.MATCH_PARENT,
                      TableLayout.LayoutParams.WRAP_CONTENT));
              indexForDrawable++;
          }
          else {
              //tablerow with date
              final TableRow row = new TableRow(getActivity());
              row.setLayoutParams(new TableRow.LayoutParams(
                      TableRow.LayoutParams.MATCH_PARENT,
                      TableRow.LayoutParams.WRAP_CONTENT));
              TextView txtEvent = new TextView(getActivity());
  </code></pre>
  
  <p>//                txtEvent.setText("\n" + dataSplit1[0]+months.indexOf(dataSplit1<a href="https://i.stack.imgur.com/SOsdI.png" rel="nofollow noreferrer">1</a>));
                  txtEvent.setText("\n" + e.getDate().substring(0, 5));
                  txtEvent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, trDate);
                  row.addView(txtEvent);
                  timelineTable.addView(row, new TableLayout.LayoutParams(
                          TableLayout.LayoutParams.MATCH_PARENT,
                          TableLayout.LayoutParams.WRAP_CONTENT));
                  dataComp = e.getDate();</p>
  
  <pre><code>            //tablerow with event entry
              final TableRow row3 = new TableRow(getActivity());
              row3.setLayoutParams(new TableRow.LayoutParams(
                      TableRow.LayoutParams.MATCH_PARENT,
                      TableRow.LayoutParams.WRAP_CONTENT));
  
              if (indexForDrawable % 2 == 0)
                  row3.setBackgroundResource(R.drawable.marcaj_event_albastru);
              else
                  row3.setBackgroundResource(R.drawable.marcaj_event_portocaliu);
              TextView txtEvent3 = new TextView(getActivity());
  
              txtEvent3.setText("    "+ e.getHour() +"-"+e.getType()+"-"+e.getTitle());
              txtEvent3.setTextColor(Color.BLACK);
              txtEvent3.setTextSize(TypedValue.COMPLEX_UNIT_DIP, trEvent);
              txtEvent3.setTypeface(Typeface.create(tf, Typeface.BOLD));
              row3.addView(txtEvent3);
              row3.setClickable(true);
              final String date3 = e.getDate(), hour3 = e.getHour(), title3 = e.getTitle(),
                      type3 = e.getType(), descriere3 = e.getDescriere();
  
              timelineTable.addView(row3, new TableLayout.LayoutParams(
                      TableLayout.LayoutParams.MATCH_PARENT,
                      TableLayout.LayoutParams.WRAP_CONTENT));
              indexForDrawable++;
          }
  </code></pre>