Class TypeFaceSpan

  • All Implemented Interfaces:
    android.text.style.UpdateAppearance, android.text.style.UpdateLayout

    public class TypeFaceSpan
    extends android.text.style.MetricAffectingSpan
    Style a Spannable with a custom Typeface. https://gist.github.com/twaddington/b91341ea5615698b53b8
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeFaceSpan​(android.content.Context context, java.lang.String typefaceName)
      Load the Typeface and apply to a Spannable.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void updateDrawState​(android.text.TextPaint tp)
      Update the Draw States
      void updateMeasureState​(android.text.TextPaint p)
      Updated the Measure State
      • Methods inherited from class android.text.style.MetricAffectingSpan

        getUnderlying
      • Methods inherited from class android.text.style.CharacterStyle

        wrap
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TypeFaceSpan

        public TypeFaceSpan​(android.content.Context context,
                            java.lang.String typefaceName)
        Load the Typeface and apply to a Spannable.
        Parameters:
        context - used to get resources
        typefaceName - name of typeface stored in asset folder
    • Method Detail

      • updateMeasureState

        public void updateMeasureState​(android.text.TextPaint p)
        Updated the Measure State
        Specified by:
        updateMeasureState in class android.text.style.MetricAffectingSpan
        Parameters:
        p - TextPaint to be modified
      • updateDrawState

        public void updateDrawState​(android.text.TextPaint tp)
        Update the Draw States
        Specified by:
        updateDrawState in class android.text.style.CharacterStyle
        Parameters:
        tp - TextPaint to be modified