First you need to create one xml file for the rounded edges, then create one linear layout and set the rounded edges in this back margin, and then dynamically add a text representation to this particular linear layout.
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/your_rounded_edges_xml_file" android:orientation="vertical" android:layout_marginRight="10dp" android:id="@+id/linearLayout"> </LinearLayout>
Here I attached my rounded edge XML file
<?xml version="1.0" encoding="UTF-8"?>
<stroke android:width="1dp" android:color="#ababab" /> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
source share