我正在使用以下代码创建超链接:
<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
中添加 android:textColorLink="yourcolorhere"
yourText.setLinkTextColor(Color.RED);
您可以在XML文件中使用:
android:textColorLink="Code"
"Code"可以是例如#ff0000
或@color/red。
您可以在Java代码中使用:
tv.setLinkTextColor(color);
颜色可以是例如Color.RED
或者Color.parseColor("#ff0000");
将以下代码行添加到您的XML
文件中的textview
中,它将完美地工作。
android:autoLink="web"
android:textColorLink="@android:color/holo_orange_dark"
android:linksClickable="true"
你需要使用 android:textColorLink="#000000"
,其中的 000000
是你所选择颜色的十六进制代码。希望这有所帮助。
<color name="colorAccent">#FF4081</color>
https://www.google.com/design/spec/style/color.html#color-color-palette
android:textColorLink="colorCode"
。希望它能起作用。TextView
标签的xml文件中:android:autoLink="web" //link the content of web
android:textColorLink="#FFFFFF" //change the color of the link
android:textColorLink="@android:color/white"
的意思是“链接文本的颜色为白色”。 - superandroid:Widget.Holo.Light.Button.Small
的按钮上将链接显示为标题。当按钮被按下时,我该如何更改链接文本的颜色? - JJD