androiddrawabletextcolor

How to Set android:textColor using drawable in Android?


I know how to set a drawable as the color of the text using xml but I don't know how it is done in Java.

In xml is something like this:

android:textColor="@drawable/selected_color"

in JAVA ?


Solution

  • Assuming that by "drawable" you mean a selector with color items, you should refer to this question.

    You won't be able to use the textcolor with image drawables, or selectors containing image drawables.