Programmatically draw line under TextView
<p>I have a layout that adds <code>TextView</code>'s in loop dynamically:</p>

<pre><code>TextView msg = new TextView(this);
TextView Bmsg = new TextView(this);
msg.setText(splittedItem[0]);
msg.setTextColor(0xFF2C85A6);
msg.setTextSize(22);
msg.setPadding(10, 10, 0, 10);
Bmsg.setText("- "+splittedItem[1]);
Bmsg.setPadding(20, 0, 10, 30);
Bmsg.setTextSize(18);
linearLayout.addView(msg);
linearLayout.addView(Bmsg);
</code></pre>

<p>And I want to divide each <code>TextView</code> with a line like this:</p>

<p><a href="https://i.stack.imgur.com/HjqLe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HjqLe.png" alt=""></a></p>

<p>I need a line under <code>Bmsg</code>. I have found this - <a href="https://stackoverflow.com/questions/9370746/draw-line-under-textview-on-android">draw line under TextView on Android</a>, but I do not understand how to make this programmatically.</p>

<p>in XML:</p>

<pre><code> &lt;LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/buttonlayout"&gt;
 &lt;/LinearLayout&gt;
</code></pre>