1

Applying a custom typeface to the title of an ActionBarin the onCreate() method of an Activity, the title is displayed in the default old style for a very short moment and after this it is shown correctly as expected. However this only happens when the activity is created and started for the first time in its lifecycle, all subsequent restarts or resumes are not affected by this.

I don't understand this "flickering" behaviour, it doesn't look very professional.

My code for applying the custom typeface to the title looks like this, wheras CustomTypefaceSpan is a custom class defined on this post :

final SpannableString s = new SpannableString(
        getString(R.string.app_name_short));
s.setSpan(
        new CustomTypefaceSpan(Typeface.createFromAsset(
        this.getAssets(), TypefaceUtils.TTF_ARDESTINE)), 0,
        s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
setTitle(s);
Community
  • 1
  • 1
Andy
  • 488
  • 4
  • 13

0 Answers0