我正在使用这个代码的超链接:
<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?
当前回答
在TextView标签的xml文件:
android:autoLink="web" //link the content of web
android:textColorLink="#FFFFFF" //change the color of the link
其他回答
添加android:textColorLink="yourcolorhere"到你的TextView
在TextView标签的xml文件:
android:autoLink="web" //link the content of web
android:textColorLink="#FFFFFF" //change the color of the link
你需要使用android:textColorLink="#000000",其中000000是你的颜色的十六进制代码。希望能有所帮助。
如果你想通过编程改变它:
yourText.setLinkTextColor(Color.RED);
你需要使用android:textColorLink="colorCode"。希望它能起作用。