how to change color of textview hyperlink?
AndroidAndroid LayoutAndroid Problem Overview
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?
Android Solutions
Solution 1 - Android
Add android:textColorLink="yourcolorhere"
to your TextView
Solution 2 - Android
If you want to change it programmatically:
yourText.setLinkTextColor(Color.RED);
Solution 3 - Android
You can use on your XML file:
android:textColorLink="Code"
the "Code" can be e.g. #ff0000
or @color/red
You can use on your JAVA code :
tv.setLinkTextColor(color);
The color can be e.g Color.RED
or Color.parseColor("#ff0000");
Solution 4 - Android
You need to use the android:textColorLink="#000000"
where 000000
is your color's hex code. Hope it helps.
Solution 5 - Android
Add these Lines of code to your textview
in XML
file and it will work perfectly fine
android:autoLink="web"
android:textColorLink="@android:color/holo_orange_dark"
android:linksClickable="true"
Solution 6 - Android
You can also open colors.xml and change the following color to whatever you want:
<color name="colorAccent">#FF4081</color>
Solution 7 - Android
If anyone needs to know the hex value for this blue it is #7bc9c2.
I used Eye Dropper to figure this out as I couldn't find it documented anywhere, it isn't on the Google Color Palatte anyway:
https://www.google.com/design/spec/style/color.html#color-color-palette
Solution 8 - Android
You need to use android:textColorLink="colorCode"
. Hope it will work.
Solution 9 - Android
In xml file of TextView
tag :
android:autoLink="web" //link the content of web
android:textColorLink="#FFFFFF" //change the color of the link