how to change color of textview hyperlink?
I am using this code for hyperlink:
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/hyperlink"
android:tex开发者_Go百科t="@string/hyperlink"
android:autoLink="web"/>
By default it is showing blue color, but how do I change color of hyperlink in Android?
Add android:textColorLink="yourcolorhere"
to your TextView
If you want to change it programmatically:
yourText.setLinkTextColor(Color.RED);
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");
You need to use the android:textColorLink="#000000"
where 000000
is your color's hex code. Hope it helps.
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"
You can also open colors.xml and change the following color to whatever you want:
<color name="colorAccent">#FF4081</color>
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
You need to use android:textColorLink="colorCode"
. Hope it will work.
In xml file of TextView
tag :
android:autoLink="web" //link the content of web
android:textColorLink="#FFFFFF" //change the color of the link
精彩评论