我正在使用这个代码的超链接:

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/hyperlink" 
    android:text="@string/hyperlink"
    android:autoLink="web"/>

默认情况下,它是显示蓝色,但我如何改变超级链接的颜色在Android?


当前回答

如果你想通过编程改变它:

yourText.setLinkTextColor(Color.RED);

其他回答

添加android:textColorLink="yourcolorhere"到你的TextView

如果你想通过编程改变它:

yourText.setLinkTextColor(Color.RED);

你需要使用android:textColorLink="colorCode"。希望它能起作用。

在TextView标签的xml文件:

android:autoLink="web" //link the content of web  
android:textColorLink="#FFFFFF" //change the color of the link 

你可以在XML文件上使用:

android:textColorLink="Code" 

“代码”可以是#ff0000或@color/red

你可以在JAVA代码中使用:

tv.setLinkTextColor(color);

颜色可以是。RED或Color.parseColor("#ff0000");