I want to show a dotted underline below the textview, following are my codes
<TextView
android:id="@+id/contact_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:text="1234567890"
android:background="@drawable/dashed_line"
android:layerType="software"
android:textSize="20dp" />
dashed_line.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="@color/oceanBlue"
android:dashWidth="2dp"
android:dashGap="3dp"
android:width="1dp"/>
</shape>
and the textview looks as above

can anyone help me to get the dotted line below to the textview?
tried with drawableBottom also but no use
android:drawableBottom="@drawable/dashed_line"
use this file for dotted line :
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:left="-5dp"
android:right="-5dp"
android:top="-5dp">
<shape
android:shape="rectangle">
<stroke
android:color="@color/oceanBlue"
android:dashWidth="2dp"
android:dashGap="3dp"
android:width="1dp"/>
</shape>
</item>
</layer-list>
then add
android:background="@drawable/dashed_line"
You can also use like this(Under Line)
TextView contacttv = (TextView) findViewById(R.id.contactTextView);
contacttv.setPaintFlags(contacttv.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With