The color of the text in the TextView changes color

In android, when I click on TextView, the text changes color (from white to gray). Could you tell me how I can disable this functionality?

Thanks.

+6
android
source share
1 answer

TextView gets its style from any styles or themes that you set in your application. See android docs for an overview.

Part of the default theme is the appearance of the widget in each of its states. The selector is used to adjust the appearance and state in a certain state, for example, if it is on or pressed.

To override the behavior, you need to create a style (as described in the android doc document above) and apply this style to your TextView.

+6
source share

All Articles