Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
    
    SuperscriptSpan
    open class SuperscriptSpan : MetricAffectingSpan, ParcelableSpan
    
    The span that moves the position of the text baseline higher. 
     The span can be used like this: 
    <code>SpannableString string = new SpannableString("1st example");
 string.setSpan(new SuperscriptSpan(), 1, 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);</code>
  Text with 
SuperscriptSpan. Note: Since the span affects the position of the text, if the text is on the first line of a TextView, it may appear cut. This can be avoided by decreasing the text size with an 
AbsoluteSizeSpan
    Summary
    
    
      
        
          | Public methods | 
        
          | open Int |  | 
        
          | open Int |  | 
        
          | open String |  | 
        
          | open Unit |  | 
        
          | open Unit | Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters. | 
        
          | open Unit | Flatten this object in to a Parcel. | 
      
    
    
      
        
          | Inherited functions | 
        
          |  | 
        
          | From class CharacterStyle
                
                  
                    | Unit | updateDrawState(tp: TextPaint!) |  
                    | CharacterStyle! | wrap(cs: CharacterStyle!)
                         A given CharacterStyle can only applied to a single region of a given Spanned. If you need to attach the same CharacterStyle to multiple regions, you can use this method to wrap it with a new object that will have the same effect but be a distinct object so that it can also be attached without conflict. |  | 
      
    
    Public constructors
    
    
      SuperscriptSpan
      
      SuperscriptSpan(src: Parcel)
      Creates a SuperscriptSpan from a parcel.
      
        
          
            | Parameters | 
          
            | src | Parcel: This value cannot be null. | 
        
      
     
    Public methods
    
      describeContents
      
      open fun describeContents(): Int
      
     
    
      getSpanTypeId
      
      open fun getSpanTypeId(): Int
     
    
      toString
      
      open fun toString(): String
      
        
          
            | Return | 
          
            | String | a string representation of the object. | 
        
      
     
    
      updateDrawState
      
      open fun updateDrawState(textPaint: TextPaint): Unit
      
        
          
            | Parameters | 
          
            | textPaint | TextPaint: This value cannot be null. | 
        
      
     
    
      updateMeasureState
      
      open fun updateMeasureState(textPaint: TextPaint): Unit
      Classes that extend MetricAffectingSpan implement this method to update the text formatting in a way that can change the width or height of characters.
      
        
          
            | Parameters | 
          
            | textPaint | TextPaint: This value cannot be null. | 
        
      
     
    
      writeToParcel
      
      open fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
      Flatten this object in to a Parcel.
      
     
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [null,null,["Last updated 2025-02-10 UTC."],[],[]]