3
 private ViewSwitcher.ViewFactory mFactory = new ViewSwitcher.ViewFactory() {

    @Override
    public View makeView() {
        TextView t = new TextView(getActivity());
        t.setTextColor(nptrackcolor); //global int variable
        t.setMaxLines(2);
        t.setMinLines(2);
       TextViewCompat.setTextAppearance(t,R.style.NowPlayingTextAppereance);
        return t;
    }
};

Today i tried to use textswitcher for updating now playing title with fade in/out animation in my app. It switches text but not the color. I realized setFactory can only called once. So is it possible to change the color of textswitchers?

LutfiTekin
  • 441
  • 1
  • 10
  • 19

1 Answers1

9

I found the solution

((TextView)textSwitcher.getNextView()).setTextColor(nptrackcolor);
LutfiTekin
  • 441
  • 1
  • 10
  • 19