标签: textswitcher

从TextSwitcher获取文本

如何获取之前设置的textswitcher中的文本.就像textview.getText()一样.我尝试了以下代码,但没有奏效.

TextSwitcher textSwitcher = (TextSwitcher)findViewById(...);
TextView currentlyShownTextView = (TextView) textSwitcher.getCurrentView();
String currentlyShownText = textSwitcher.getText().toString();
Run Code Online (Sandbox Code Playgroud)

android textview textswitcher

4
推荐指数
1
解决办法
1463
查看次数

文本切换器更新textview颜色

 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;
    }
};
Run Code Online (Sandbox Code Playgroud)

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

android textview textswitcher

2
推荐指数
1
解决办法
592
查看次数

标签 统计

android ×2

textswitcher ×2

textview ×2