Package io.rong.imkit.utils
Class TextViewUtils
-
- All Implemented Interfaces:
public class TextViewUtils处理 textMessage 和 ReferenceMessage 的文本内容
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceTextViewUtils.RegularCallBackpublic classTextViewUtils.URLSpanUnderlineSameColor自定义链接样式:保留下划线,同时保持与普通文字一致的颜色。 通过先记录调用前的颜色,再覆盖为默认文字色,避免主题默认的链接色。
-
Constructor Summary
Constructors Constructor Description TextViewUtils()
-
Method Summary
Modifier and Type Method Description static SpannableStringBuildergetSpannable(String content, TextViewUtils.RegularCallBack callBack)static SpannableStringBuildergetSpannable(String content, boolean regular, TextViewUtils.RegularCallBack callBack)static SpannableStringBuildergetRichSpannable(String content, TextViewUtils.RegularCallBack callBack, @ColorInt() int foregroundColor)static voidsetCompoundDrawables(TextView textView, int gravity, int resId)设置 TextView 的setCompoundDrawablesRelative static voidenableDrawableAutoMirror(TextView textView)设置 TextView 的 Drawable 自动翻转,适用于带有方向性的 Drawable -
-
Method Detail
-
getSpannable
static SpannableStringBuilder getSpannable(String content, TextViewUtils.RegularCallBack callBack)
- Parameters:
content- 替换内容callBack- 异步请求回调- Returns:
内容的 spannable
-
getSpannable
static SpannableStringBuilder getSpannable(String content, boolean regular, TextViewUtils.RegularCallBack callBack)
- Parameters:
content- 替换内容callBack- 异步请求回调- Returns:
内容的 spannable
-
getRichSpannable
static SpannableStringBuilder getRichSpannable(String content, TextViewUtils.RegularCallBack callBack, @ColorInt() int foregroundColor)
- Parameters:
content- 替换内容callBack- 异步请求回调- Returns:
内容的 spannable
-
setCompoundDrawables
static void setCompoundDrawables(TextView textView, int gravity, int resId)
设置 TextView 的setCompoundDrawablesRelative
- Parameters:
textView- TextViewgravity- 仅支持设置:Gravity.START,Gravity.TOP,Gravity.END,Gravity.resId- 资源ID
-
enableDrawableAutoMirror
static void enableDrawableAutoMirror(TextView textView)
设置 TextView 的 Drawable 自动翻转,适用于带有方向性的 Drawable
- Parameters:
textView- TextView
-
-
-
-