Underline text in an Android layout?
In Android, a TextView is a primary UI element used to display text present in the form of characters, numbers, strings, and paragraphs. However, styles cannot be applied to text present in the TextView. So in this article, we will show you how you could underline text in a TextView in Android.
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn_add_contact"
android:textAllCaps="false"
android:textColor="#57a0d4"
style="@style/Widget.AppCompat.Button.Borderless.Colored" />
Textview:
TextView textView = (TextView) findViewById(R.id.textview1);
textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
Post a Comment
0Comments