Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text Switcher update textview color

 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?

like image 619
LutfiTekin Avatar asked Dec 29 '25 00:12

LutfiTekin


1 Answers

I found the solution

((TextView)textSwitcher.getNextView()).setTextColor(nptrackcolor);
like image 138
LutfiTekin Avatar answered Dec 30 '25 14:12

LutfiTekin