Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 899
Cody Caughlan Avatar asked Feb 23 '11 01:02

Cody Caughlan


People also ask

Which of the following is used to set the background color Android?

Inside the function use setBackgroundResource(R. color. button_color) function, this will set the background with color button_color.

How do I change the background color on my android theme?

Use the colors in your themeOpen themes. xml (app > res > values > themes > themes. xml). Change colorPrimary to the primary color you selected, @color/green .

What attribute of the application element is used to specify the theme?

You can create a theme the same way you create styles. The difference is how you apply it: instead of applying a style with the style attribute on a view, you apply a theme with the android:theme attribute on either the <application> tag or an <activity> tag in the AndroidManifest. xml file.

How can change background color of button in XML?

To set Android Button background color, we can assign android:backgroundTint XML attribute for Button in layout file with the required Color Value. To programmatically set or change Android Button background color, we may call pass the method Button.


1 Answers

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.

like image 139
rfgamaral Avatar answered Sep 28 '22 08:09

rfgamaral