我正在使用这个代码的超链接:
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/hyperlink"
android:text="@string/hyperlink"
android:autoLink="web"/>
默认情况下,它是显示蓝色,但我如何改变超级链接的颜色在Android?
我正在使用这个代码的超链接:
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/hyperlink"
android:text="@string/hyperlink"
android:autoLink="web"/>
默认情况下,它是显示蓝色,但我如何改变超级链接的颜色在Android?
当前回答
将这些代码行添加到XML文件中的textview,它将工作得非常好
android:autoLink="web"
android:textColorLink="@android:color/holo_orange_dark"
android:linksClickable="true"
其他回答
你可以在XML文件上使用:
android:textColorLink="Code"
“代码”可以是#ff0000或@color/red
你可以在JAVA代码中使用:
tv.setLinkTextColor(color);
颜色可以是。RED或Color.parseColor("#ff0000");
你需要使用android:textColorLink="#000000",其中000000是你的颜色的十六进制代码。希望能有所帮助。
在TextView标签的xml文件:
android:autoLink="web" //link the content of web
android:textColorLink="#FFFFFF" //change the color of the link
添加android:textColorLink="yourcolorhere"到你的TextView
你需要使用android:textColorLink="colorCode"。希望它能起作用。