Skip to content

Android TextView部分文字变色、改变大小、点击工具类。轻量级富文本实现

License

Notifications You must be signed in to change notification settings

CuiZhaoHui/SpannableHelper

Repository files navigation

SpannableHelper

快速实现文本部分变色、改变大小、部分点击的轻量工具类

Screenshot

usage

Step1:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step2:

implementation 'com.github.CuiZhaoHui:SpannableHelper:1.0.3'

Step3:

SpannableHelper.with(textView, content)
    .addChangeItem(ChangeItem(changeStr, ChangeItem.Type.SIZE, textSize))//Change text size
    .addChangeItem(ChangeItem(changeStr,ChangeItem.Type.COLOR,textColor,isClickAble))// Change text color
    .addChangeItem(ImageChanger(changeStr, [Image resource id], [image width],
                        [image height], [left margin], [right margin], isClickAble, changeAllPlace))//Change text to icon
    .setTextClickListener(object : TextClickListener {
        override fun onTextClick(clickContent: String) {
            //TODO do something
        }
    })
    .build()//Do not forget build()!~~

About

Android TextView部分文字变色、改变大小、点击工具类。轻量级富文本实现

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages