Class SpanUtil
- java.lang.Object
-
- com.google.android.exoplayer2.text.span.SpanUtil
-
public final class SpanUtil extends Object
Utility methods for Android span styling.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddOrReplaceSpan(Spannable spannable, Object span, int start, int end, int spanFlags)Addsspantospannablebetweenstartandend, removing any existing spans of the same type and with the same indices and flags.
-
-
-
Method Detail
-
addOrReplaceSpan
public static void addOrReplaceSpan(Spannable spannable, Object span, int start, int end, int spanFlags)
Addsspantospannablebetweenstartandend, removing any existing spans of the same type and with the same indices and flags.This is useful for types of spans that don't make sense to duplicate and where the evaluation order might have an unexpected impact on the final text, e.g.
ForegroundColorSpan.- Parameters:
spannable- TheSpannableto addspanto.span- The span object to be added.start- The start index to add the new span at.end- The end index to add the new span at.spanFlags- The flags to pass toSpannable.setSpan(Object, int, int, int).
-
-