SuperTextView-支持多种字体样式和图片混排

单个textview支持多种字体样式,支持插入图片

  • 下载和demo见GitHub:

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,327评论 25 709
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,669评论 2 45
  • 这是你新换的微信名。我知道你一定希望我能看到。 现在的自己变得很懦弱,想你了不敢说出来。怕你知道又怕你不知道。...
    简约心书阅读 1,098评论 0 0