I am trying this but it does not work for me
Paint p = new Paint();
p.setColor(ContextCompat.getColor(textView.getContext(),android.R.color.holo_red_dark));
textView.setPaintFlags(p.getColor());
textView.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
I am trying this but it does not work for me
Paint p = new Paint();
p.setColor(ContextCompat.getColor(textView.getContext(),android.R.color.holo_red_dark));
textView.setPaintFlags(p.getColor());
textView.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
try this way,
Paint p = new Paint();
p.setColor(ContextCompat.getColor(this,android.R.color.holo_red_dark));
p.setflags(Paint.UNDERLINE_TEXT_FLAG);
textView.setPaintFlags(p.getFlags());
for more see this question.
edittext.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_IN);
Create a under_line.xml file into drawable folder then set your textview background like this android:background="@drawable/under_line"
add this xml in your drawable folder uder_line.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:bottom="-15dp">
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="0.5"
android:pivotY="0.5"
android:toDegrees="0">
<shape android:shape="line">
<stroke
android:width="1dp"
android:color="@android:color/holo_red_dark" />
</shape>
</rotate>
</item></layer-list>
Then set your layout text view background like this
android:background="@drawable/under_line"