Cody Caughlan
Cody Caughlan

Reputation: 32748

Whats the Android Style attribute for selected link background color?

I have a TextView which I dynamically add clickable links via Linkify (with a custom TransformFilter). This all works great. What I would like to do now is change the background color of the link when its clicked. In CSS it would be done via the :active pseudo-selector.

I would think I can specify this in styles.xml but I dont know what the parameter name is.

Upvotes: 5

Views: 3107

Answers (2)

rfgamaral
rfgamaral

Reputation: 16842

Just had this problem myself and the solution for me (but I didn't use Linkify) was the android:textColorHighlight attribute. I used android:linksClickable="true" instead of Linkify though. That won't probably make any difference.

Upvotes: 7

Reno
Reno

Reputation: 33792

This might solve your problem .

Basically you have to define a ColorStateList (a xml to be used as a drawable). For your TextView

Upvotes: 0

Related Questions