I am using this code for hyperlink:
<TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/hyperlink" android:text="@string/hyperlink" android:autoLink="web"/>
By default it is showing blue color, but how do I change color of hyperlink in Android?
To change the color of hyperlink text, click the arrow next to Hyperlink, and then select a color. To change the color of followed hyperlink text, click the arrow next to Followed Hyperlink, and then select a color.
TextView Text Color – To change the color of text in TextView, you can set the color in layout XML file using textColor attribute or change the color dynamically in Kotlin file using setTextColor() method.
This is the shortest solution: final CharSequence text = tv. getText(); final SpannableString spannableString = new SpannableString( text ); spannableString. setSpan(new URLSpan(""), 0, spannableString.
1. Hyperlinks. Hyperlinks are blue for two reasons, depending on who you believe. Blue looks like a default choice.
Add android:textColorLink="yourcolorhere"
to your TextView
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