单个textview支持多种字体样式,支持插入图片
- 下载和demo见GitHub:
Add SuperTextView to your project
Gradle:
compile 'cn.yzapp.supertextview:supertextview:[look download]@aar'
Maven:
<dependency>
<groupId>cn.yzapp.supertextview</groupId>
<artifactId>supertextview</artifactId>
<version>[look download]</version>
<type>aar</type>
</dependency>
Use
RoundedStrokeSpan strokeSpan = new RoundedStrokeSpan(this, R.color.colorAccent, R.color.colorPrimary);
strokeSpan.setPadding(8, -8, 10, 18);
SuperTextView textView = (SuperTextView) findViewById(R.id.textview);
textView.addText("你好世界", new ForegroundColorSpan(getResources().getColor(R.color.colorAccent)),new StrikethroughSpan())
.text("电话")
.setSpan(strokeSpan)
.setUrl("tel:0123456789")
.setFontColor(getResources().getColor(R.color.colorPrimary))
.add()
.addImage(getResources().getDrawable(R.drawable.icon_city))
.text("我的blog")
.setUrl("http://blog.yzapp.cn")
.setFontStyle(Typeface.BOLD_ITALIC)
.setFontColor(getResources().getColor(R.color.colorPrimary))
.add();
此为blog备份,原地址:http://blog.yzapp.cn/SuperTextView-支持多种字体样式和图片混排.html