【问题标题】:Text Switcher update textview color文本切换器更新文本视图颜色
【发布时间】:2016-09-22 10:41:56
【问题描述】:
 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;
    }
};

今天我尝试使用 textswitcher 在我的应用程序中使用淡入/淡出动画更新正在播放的标题。它切换文本但不切换颜色。我意识到 setFactory 只能调用一次。那么是否可以更改文本切换器的颜色?

【问题讨论】:

    标签: android textview textswitcher


    【解决方案1】:

    我找到了解决办法

    ((TextView)textSwitcher.getNextView()).setTextColor(nptrackcolor);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-10
      • 1970-01-01
      • 2012-12-13
      • 2014-09-03
      • 1970-01-01
      • 2021-07-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多