分类: Android2014-09-25 13:17 3431人阅读 评论(0) 收藏 举报
以编程的方式添给 TextView 添加删除线:

  1. textview.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);

顺便研究下:

TextView.getPaint() :

  1. // Returns the base paint used for the text.
  2. // Please use this only to consult the Paint's properties and not to change them.
  3. public TextPaint getPaint();

TextPaint:

  1. // TextPaint is an extension of Paint that leaves room
  2. // for some extra data used during text measuring and drawing.
  3. public class TextPaint extends Paint {...}

Paint:

  1. // The Paint class holds the style and color information
  2. // about how to draw geometries, text and bitmaps.
  3. public class Paint extends Object {...}

Paint.setFlags():

  1. // Set the paint's flags. Use the Flag enum to specific flag values.
  2. // flags: The new flag bits for the paint
  3. public void setFlags (int flags);

Paint.STRIKE_THRU_TEXT_FLAG:

  1. // Paint flag that applies a strike-through decoration to drawn text.
  2. // Constant Value: 16 (0x00000010)
  3. public static final int STRIKE_THRU_TEXT_FLAG;

参考资料:

http://blog.csdn.net/lilin_emcc/article/details/39549541

Android: 在 TextView 里使用删除线的更多相关文章

  1. Android在一个TextView里显示不同样式的字体

    在同一个TextView里显示不同样式的字体 public void setSpan(Object what, int start, int end, int flags); 样式1:背景色.粗体.字 ...

  2. Android TextView里显示两种颜色

    今天介绍一个小技巧,在Android的TextView里设置两种颜色,直接上代码: TextView TV = (TextView)findViewById(R.id.mytextview01); S ...

  3. Android中TextView添加删除线

    项目中的需求~~~~ 商城中物品的一个本身价格,还有一个就是优惠价格...需要用到一个删除线. public class TestActivity extends Activity { private ...

  4. 【转】Android TextView SpannableStringBuilder 图文混排颜色斜体粗体下划线删除线

    spannableStringBuilder 用法详解: SpannableString ss = new SpannableString("红色打电话斜体删除线绿色下划线图片:." ...

  5. Android之TextView的样式类Span的使用详解

           Android中的TextView是个显示文字的的UI类,在现实中的需求中,文字有各式各样的样式,TextView本身没有属性去设置实现,我们可以通过Android提供的 Spannab ...

  6. 【Android】 TextView设置个别字体样式

    SpannableString msp = new SpannableString("测试"+XM+"更换当前号码将从手机发送一条普通短信进行验证"); msp ...

  7. TextView里的文 html

    一.[Android实例]实现TextView里的文字有不同颜色 转eoe:http://www.eoeandroid.com/thread-4496-1-1.html import android. ...

  8. [Android教程]TextView使用SpannableString设置复合文本

    TextView通常用来显示普通文本,但是有时候需要对其中某些文本进行样式.事件方面的设置.Android系统通过SpannableString类来对指定文本进行相关处理,具体有以下功能: 1.Bac ...

  9. Android的TextView使用Html来处理图片显示、字体样式、超链接等

    一.[Android实例]实现TextView里的文字有不同颜色 转eoe:http://www.eoeandroid.com/thread-4496-1-1.html import android. ...

随机推荐

  1. poll函数和串口设置

    2015.1.24 今天星期六,多云,早晨8:17起床的,今天是来南京起床最迟的一天,因为昨晚睡得有点迟,今天又不用上课,整个人有点放松.收拾好来到教室,教室门没有开,胡明也到了,其他人还在宿舍睡觉, ...

  2. PHP_Const

    PHP_Const 常量 规则: 1 总是大写 2 A-Z 及 从127-255的ASCII字符 3 全局范围 4 用define函数定义 5 只能包含标量数据 如Boolean integer fl ...

  3. AmazeUI常用组件

    按钮样式 <span class="am-badge">1</span>  #正方形 <span class="am-badge am-ba ...

  4. iOS 静态库和动态库的区别&静态库的生成

    linux中静态库和动态库的区别 一.不同 库从本质上来说是一种可执行代码的二进制格式,可以被载入内存中执行.库分静态库和动态库两种. 1. 静态函数库 这类库的名字一般是libxxx.a:利用静态函 ...

  5. array_intersect() php筛选两个数组共有的元素

    我们已经讲过如何筛选出连个数组中不共有的元素,今天就来看看php如何筛选出两个数组中共有的元素,例如筛选$array1和$array2共有的元素. 函数名:array_intersect(): 调用方 ...

  6. Unity3D ShaderLab 使用alpha参数创建透明效果

    Unity3D ShaderLab 使用alpha参数创建透明效果 其实Unity为了方便我们的工作,为我们内置了很多参数.比如马上用到的透明功能. 准备场景新建Shader Material ,一张 ...

  7. HDU 4004

    http://acm.hdu.edu.cn/showproblem.php?pid=4004 题意:青蛙过长L的河,只能落在石头上,石头数量是n,给出n个坐标,至多跳m次,求在可以过河的条件下,青蛙跳 ...

  8. String.Format 全汇总

    C#格式化数值结果表 字符 说明 示例 输出 C 货币 string.Format("{0:C3}", 2) $2.000 D 十进制 string.Format("{0 ...

  9. LeetCode Rotate Image (模拟)

    题意: 将一个n*n的矩阵顺时针旋转90度. 思路: 都是差不多的思路,交换3次也行,反转再交换也是行的. class Solution { public: void rotate(vector< ...

  10. 【题解】【BST】【Leetcode】Convert Sorted Array to Binary Search Tree

    Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路: ...