List of usage examples for android.widget TextSwitcher TextSwitcher
public TextSwitcher(Context context)
From source file:com.waz.zclient.BasePreferenceActivity.java
@SuppressLint("PrivateResource") @Override//from w w w . j av a 2 s. co m public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); replaceFragmentStrategy = new PreferenceScreenStrategy.ReplaceFragment(this, R.anim.abc_fade_in, R.anim.abc_fade_out, R.anim.abc_fade_in, R.anim.abc_fade_out); toolbar = ViewUtils.getView(this, R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); assert ab != null; ab.setDisplayHomeAsUpEnabled(true); title = getTitle(); titleSwitcher = new TextSwitcher(toolbar.getContext()); titleSwitcher.setFactory(new ViewSwitcher.ViewFactory() { @Override public View makeView() { TextView tv = new AppCompatTextView(toolbar.getContext()); TextViewCompat.setTextAppearance(tv, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title); return tv; } }); titleSwitcher.setCurrentText(title); ab.setCustomView(titleSwitcher); ab.setDisplayShowCustomEnabled(true); ab.setDisplayShowTitleEnabled(false); titleSwitcher.setInAnimation(this, R.anim.abc_fade_in); titleSwitcher.setOutAnimation(this, R.anim.abc_fade_out); }