public final class SpanUtils
extends java.lang.Object
desc : SpannableString相关工具类
author : xuexiang
time : 2018/4/28 上午12:43
| Modifier and Type | Class and Description |
|---|---|
static interface |
SpanUtils.Align |
| Modifier and Type | Field and Description |
|---|---|
static int |
ALIGN_BASELINE |
static int |
ALIGN_BOTTOM |
static int |
ALIGN_CENTER |
static int |
ALIGN_TOP |
| Constructor and Description |
|---|
SpanUtils() |
| Modifier and Type | Method and Description |
|---|---|
SpanUtils |
append(java.lang.CharSequence text)
Append the text text.
|
SpanUtils |
appendImage(android.graphics.Bitmap bitmap)
Append one image.
|
SpanUtils |
appendImage(android.graphics.Bitmap bitmap,
int align)
Append one image.
|
SpanUtils |
appendImage(android.graphics.drawable.Drawable drawable)
Append one image.
|
SpanUtils |
appendImage(android.graphics.drawable.Drawable drawable,
int align)
Append one image.
|
SpanUtils |
appendImage(int resourceId)
Append one image.
|
SpanUtils |
appendImage(int resourceId,
int align)
Append one image.
|
SpanUtils |
appendImage(android.net.Uri uri)
Append one image.
|
SpanUtils |
appendImage(android.net.Uri uri,
int align)
Append one image.
|
SpanUtils |
appendLine()
Append one line.
|
SpanUtils |
appendLine(java.lang.CharSequence text)
Append text and one line.
|
SpanUtils |
appendSpace(int size)
Append space.
|
SpanUtils |
appendSpace(int size,
int color)
Append space.
|
android.text.SpannableStringBuilder |
create()
Create the span string.
|
SpanUtils |
setAlign(android.text.Layout.Alignment alignment)
Set the span of alignment.
|
SpanUtils |
setBackgroundColor(int color)
Set the span of background's color.
|
SpanUtils |
setBlur(float radius,
android.graphics.BlurMaskFilter.Blur style)
Set the span of blur.
|
SpanUtils |
setBold()
Set the span of bold.
|
SpanUtils |
setBoldItalic()
Set the span of bold italic.
|
SpanUtils |
setBullet(int gapWidth)
Set the span of bullet.
|
SpanUtils |
setBullet(int color,
int radius,
int gapWidth)
Set the span of bullet.
|
SpanUtils |
setClickSpan(android.text.style.ClickableSpan clickSpan)
Set the span of click.
|
SpanUtils |
setFlag(int flag)
Set the span of flag.
|
SpanUtils |
setFontFamily(java.lang.String fontFamily)
Set the span of font family.
|
SpanUtils |
setFontProportion(float proportion)
Set the span of proportion of font.
|
SpanUtils |
setFontSize(int size)
Set the span of font's size.
|
SpanUtils |
setFontSize(int size,
boolean isSp)
Set the span of size of font.
|
SpanUtils |
setFontXProportion(float proportion)
Set the span of transverse proportion of font.
|
SpanUtils |
setForegroundColor(int color)
Set the span of foreground's color.
|
SpanUtils |
setItalic()
Set the span of italic.
|
SpanUtils |
setLeadingMargin(int first,
int rest)
Set the span of leading margin.
|
SpanUtils |
setLineHeight(int lineHeight)
Set the span of line height.
|
SpanUtils |
setLineHeight(int lineHeight,
int align)
Set the span of line height.
|
SpanUtils |
setQuoteColor(int color)
Set the span of quote's color.
|
SpanUtils |
setQuoteColor(int color,
int stripeWidth,
int gapWidth)
Set the span of quote's color.
|
SpanUtils |
setShader(android.graphics.Shader shader)
Set the span of shader.
|
SpanUtils |
setShadow(float radius,
float dx,
float dy,
int shadowColor)
Set the span of shadow.
|
SpanUtils |
setSpans(java.lang.Object... spans)
Set the spans.
|
SpanUtils |
setStrikethrough()
Set the span of strikethrough.
|
SpanUtils |
setSubscript()
Set the span of subscript.
|
SpanUtils |
setSuperscript()
Set the span of superscript.
|
SpanUtils |
setTypeface(android.graphics.Typeface typeface)
Set the span of typeface.
|
SpanUtils |
setUnderline()
Set the span of underline.
|
SpanUtils |
setUrl(java.lang.String url)
Set the span of url.
|
public static final int ALIGN_BOTTOM
public static final int ALIGN_BASELINE
public static final int ALIGN_CENTER
public static final int ALIGN_TOP
public SpanUtils setFlag(int flag)
flag - The flag.
Spanned.SPAN_INCLUSIVE_EXCLUSIVESpanned.SPAN_INCLUSIVE_INCLUSIVESpanned.SPAN_EXCLUSIVE_EXCLUSIVESpanned.SPAN_EXCLUSIVE_INCLUSIVESpanUtils instancepublic SpanUtils setForegroundColor(int color)
color - The color of foregroundSpanUtils instancepublic SpanUtils setBackgroundColor(int color)
color - The color of backgroundSpanUtils instancepublic SpanUtils setLineHeight(int lineHeight)
lineHeight - The line height, in pixel.SpanUtils instancepublic SpanUtils setLineHeight(int lineHeight, int align)
lineHeight - The line height, in pixel.align - The alignment.
SpanUtils instancepublic SpanUtils setQuoteColor(int color)
color - The color of quoteSpanUtils instancepublic SpanUtils setQuoteColor(int color, int stripeWidth, int gapWidth)
color - The color of quote.stripeWidth - The width of stripe, in pixel.gapWidth - The width of gap, in pixel.SpanUtils instancepublic SpanUtils setLeadingMargin(int first, int rest)
first - The indent for the first line of the paragraph.rest - The indent for the remaining lines of the paragraph.SpanUtils instancepublic SpanUtils setBullet(int gapWidth)
gapWidth - The width of gap, in pixel.SpanUtils instancepublic SpanUtils setBullet(int color, int radius, int gapWidth)
color - The color of bullet.radius - The radius of bullet, in pixel.gapWidth - The width of gap, in pixel.SpanUtils instancepublic SpanUtils setFontSize(int size)
size - The size of font.SpanUtils instancepublic SpanUtils setFontSize(int size, boolean isSp)
size - The size of font.isSp - True to use sp, false to use pixel.SpanUtils instancepublic SpanUtils setFontProportion(float proportion)
proportion - The proportion of font.SpanUtils instancepublic SpanUtils setFontXProportion(float proportion)
proportion - The transverse proportion of font.SpanUtils instancepublic SpanUtils setStrikethrough()
SpanUtils instancepublic SpanUtils setUnderline()
SpanUtils instancepublic SpanUtils setSuperscript()
SpanUtils instancepublic SpanUtils setSubscript()
SpanUtils instancepublic SpanUtils setItalic()
SpanUtils instancepublic SpanUtils setBoldItalic()
SpanUtils instancepublic SpanUtils setFontFamily(java.lang.String fontFamily)
fontFamily - The font family.
SpanUtils instancepublic SpanUtils setTypeface(android.graphics.Typeface typeface)
typeface - The typeface.SpanUtils instancepublic SpanUtils setAlign(android.text.Layout.Alignment alignment)
alignment - The alignment.
Layout.Alignment.ALIGN_NORMALLayout.Alignment.ALIGN_OPPOSITELayout.Alignment.ALIGN_CENTERSpanUtils instancepublic SpanUtils setClickSpan(android.text.style.ClickableSpan clickSpan)
Must set view.setMovementMethod(LinkMovementMethod.getInstance())
clickSpan - The span of click.SpanUtils instancepublic SpanUtils setUrl(java.lang.String url)
Must set view.setMovementMethod(LinkMovementMethod.getInstance())
url - The url.SpanUtils instancepublic SpanUtils setBlur(float radius, android.graphics.BlurMaskFilter.Blur style)
radius - The radius of blur.style - The style.
BlurMaskFilter.Blur.NORMALBlurMaskFilter.Blur.SOLIDBlurMaskFilter.Blur.OUTERBlurMaskFilter.Blur.INNERSpanUtils instancepublic SpanUtils setShader(android.graphics.Shader shader)
shader - The shader.SpanUtils instancepublic SpanUtils setShadow(float radius, float dx, float dy, int shadowColor)
radius - The radius of shadow.dx - X-axis offset, in pixel.dy - Y-axis offset, in pixel.shadowColor - The color of shadow.SpanUtils instancepublic SpanUtils setSpans(java.lang.Object... spans)
spans - The spans.SpanUtils instancepublic SpanUtils append(java.lang.CharSequence text)
text - The text.SpanUtils instancepublic SpanUtils appendLine(java.lang.CharSequence text)
SpanUtils instancepublic SpanUtils appendImage(android.graphics.Bitmap bitmap)
bitmap - The bitmap of image.SpanUtils instancepublic SpanUtils appendImage(android.graphics.Bitmap bitmap, int align)
bitmap - The bitmap.align - The alignment.
SpanUtils instancepublic SpanUtils appendImage(android.graphics.drawable.Drawable drawable)
drawable - The drawable of image.SpanUtils instancepublic SpanUtils appendImage(android.graphics.drawable.Drawable drawable, int align)
drawable - The drawable of image.align - The alignment.
SpanUtils instancepublic SpanUtils appendImage(android.net.Uri uri)
uri - The uri of image.SpanUtils instancepublic SpanUtils appendImage(android.net.Uri uri, int align)
uri - The uri of image.align - The alignment.
SpanUtils instancepublic SpanUtils appendImage(int resourceId)
resourceId - The resource id of image.SpanUtils instancepublic SpanUtils appendImage(int resourceId, int align)
resourceId - The resource id of image.align - The alignment.
SpanUtils instancepublic SpanUtils appendSpace(int size)
size - The size of space.SpanUtils instancepublic SpanUtils appendSpace(int size, int color)
size - The size of space.color - The color of space.SpanUtils instancepublic android.text.SpannableStringBuilder create()