程序包 dev.utils.common

类 HtmlUtils

java.lang.Object
dev.utils.common.HtmlUtils

public final class HtmlUtils extends Object
detail: Html 工具类
作者:
Ttt
  • 字段详细资料

    • REMOVE_PADDING_MARGIN_STYLE

      public static final String REMOVE_PADDING_MARGIN_STYLE
      另请参阅:
  • 方法详细资料

    • addRemovePaddingMargin

      public static String addRemovePaddingMargin(String html)
      为给定的 Html 移除 padding、margin
      参数:
      html - HTML 字符串
      返回:
      Html 内容字符串
    • addHtmlColor

      public static String addHtmlColor(String content, String color)
      为给定的字符串添加 HTML 颜色标记
      参数:
      content - 给定的字符串
      color - 颜色值, 如: #000000
      返回:
      Html 内容字符串
    • addHtmlColor

      public static String addHtmlColor(String format, String content, String color)
      为给定的字符串添加 HTML 颜色标记
      参数:
      format - 格式化字符串
      content - 给定的字符串
      color - 颜色值, 如: #000000
      返回:
      Html 内容字符串
    • addHtmlBold

      public static String addHtmlBold(String content)
      为给定的字符串添加 HTML 加粗标记
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlColorAndBold

      public static String addHtmlColorAndBold(String content, String color)
      为给定的字符串添加 HTML 颜色标记并加粗
      参数:
      content - 给定的字符串
      color - 颜色值, 如: #000000
      返回:
      Html 内容字符串
    • addHtmlUnderline

      public static String addHtmlUnderline(String content)
      为给定的字符串添加 HTML 下划线
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlStrikeThruLine

      public static String addHtmlStrikeThruLine(String content)
      为给定的字符串添加 HTML 中划线
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlOverLine

      public static String addHtmlOverLine(String content)
      为给定的字符串添加 HTML 上划线
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlIncline

      public static String addHtmlIncline(String content)
      为给定的字符串添加 HTML 字体倾斜
           如果需要倾斜自定义角度, 需要自定义 TextView, 在 onDraw 里面加上倾斜度, 上下左右居中
           canvas.rotate( 倾斜角度, getMeasuredWidth() / 3, getMeasuredHeight() / 3);
       
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlSPAN

      public static String addHtmlSPAN(String content)
      为给定的字符串添加 HTML SPAN 标签
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlP

      public static String addHtmlP(String content)
      为给定的字符串添加 HTML P 标签
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlIMG

      public static String addHtmlIMG(String url)
      为给定的字符串添加 HTML IMG 标签
      参数:
      url - 图片链接
      返回:
      Html 内容字符串
    • addHtmlIMG

      public static String addHtmlIMG(String url, String width, String height)
      为给定的字符串添加 HTML IMG 标签
      参数:
      url - 图片链接
      width - 图片宽度
      height - 图片高度
      返回:
      Html 内容字符串
    • addHtmlIMGByWidth

      public static String addHtmlIMGByWidth(String url, String width)
      为给定的字符串添加 HTML IMG 标签
      参数:
      url - 图片链接
      width - 图片宽度
      返回:
      Html 内容字符串
    • addHtmlIMGByHeight

      public static String addHtmlIMGByHeight(String url, String height)
      为给定的字符串添加 HTML IMG 标签
      参数:
      url - 图片链接
      height - 图片高度
      返回:
      Html 内容字符串
    • addHtmlDIV

      public static String addHtmlDIV(String content)
      为给定的字符串添加 HTML DIV 标签
      参数:
      content - 给定的字符串
      返回:
      Html 内容字符串
    • addHtmlDIVByMargin

      public static String addHtmlDIVByMargin(String content, String margin)
      为给定的字符串添加 HTML DIV 标签
      参数:
      content - 给定的字符串
      margin - margin 边距
      返回:
      Html 内容字符串
    • addHtmlDIVByPadding

      public static String addHtmlDIVByPadding(String content, String padding)
      为给定的字符串添加 HTML DIV 标签
      参数:
      content - 给定的字符串
      padding - padding 边距
      返回:
      Html 内容字符串
    • addHtmlDIVByMarginPadding

      public static String addHtmlDIVByMarginPadding(String content, String margin, String padding)
      为给定的字符串添加 HTML DIV 标签
      参数:
      content - 给定的字符串
      margin - margin 边距
      padding - padding 边距
      返回:
      Html 内容字符串
    • keywordReplaceHtmlColor

      public static String keywordReplaceHtmlColor(String content, String keyword, String color)
      将给定的字符串中所有给定的关键字标色
      参数:
      content - 给定的字符串
      keyword - 给定的关键字
      color - 颜色值, 如: #000000
      返回:
      Html 内容字符串