如何设置TextAppearanceSpan的TextColor?

mic*_*ael 4 android

我目前能够创建一个中等大小的TextAppearanceSpan,但是如何将文本颜色设置为指定的RBG颜色(比如#c71585)?

new TextAppearanceSpan(context, android.R.style.TextAppearance_Medium);
Run Code Online (Sandbox Code Playgroud)

我看到有一个构造函数

public TextAppearanceSpan(Context context, int appearance,
                          int colorList) {
Run Code Online (Sandbox Code Playgroud)

但是colorList的int是什么?这有什么例子吗?

谢谢.

Rom*_*rik 7

为什么不使用a TextAppearanceSpan,colorList与a一起使用ForegroundColorSpan

  • 我已经解决了。我需要做 new ForegroundColorSpan(context.getResources().getColor(R.color.mycolor)) 抱歉误报 (2认同)